import java.io.PrintStream;
import java.util.Arrays;
import java.util.Scanner;

/**
 * Solution to Dishonest Lottery
 * 
 * @author vanb
 */
public class dishonest_vanb
{
    /** Input. */
    private static Scanner sc;
    
    /** Output. */
    private static PrintStream ps;
    
    /**
     * Do it!
     */
    private void doit()
    {
        // Just keep a count of how many times each number appears
        int counts[] = new int[51];
        Arrays.fill( counts, 0 );
        
        // loop over 10*n drawings
        int n = sc.nextInt();
        for( int i=0; i<10*n; i++ )
        {
            for( int j=0; j<5; j++ )
            {
                ++counts[sc.nextInt()];
            }
        }
        
        // See if there are any. Also use this to manage spacing.
        boolean atLeastOne = false;
        for( int i=1; i<=50; i++ )
        {
            // Are there more than 2n of this number?
            if( counts[i]>n+n )
            {
                ps.print( (atLeastOne?" ":"") + i );
                atLeastOne = true;
            }
        }
        
        // If there's at least one, we just want to end the line.
        // If not, the answer is -1
        ps.println( atLeastOne ? "" : "-1" );
    }
        
    /**
     * Main.
     * 
     * @param args unused
     * @throws Exception
     */
    public static void main( String[] args ) throws Exception
    {
        sc = new Scanner( System.in );
        ps = System.out;
        
        new dishonest_vanb().doit();
    }

}
