// Задача "Олимпийские игры"
// Шестая индивидуальная Интернет-олимпиада сезона 2009-2010.
// Автор задачи: Федор Царев, tsarev@rain.ifmo.ru
// Автор решения: Антон Ахи, akhi@rain.ifmo.ru

import java.io.*;
import java.util.*;
import java.math.*;

public class olympic_aa {
	public static void main(String[] args) throws Throwable {
		new olympic_aa().run();
	}

	BufferedReader br;
	StringTokenizer st;
	PrintWriter out;
	boolean eof = false;
	Random rand = new Random(this.hashCode());

	private void run() throws Throwable {
		Locale.setDefault(Locale.US);
		br = new BufferedReader(new FileReader(FNAME + ".in"));
		out = new PrintWriter(FNAME + ".out");
		solve();
		out.close();
	}

	String nextToken() {
		while (st == null || !st.hasMoreTokens()) {
			try {
				st = new StringTokenizer(br.readLine());
			} catch (Exception e) {
				eof = true;
				return "0";
			}
		}
		return st.nextToken();
	}

	int nextInt() {
		return Integer.parseInt(nextToken());
	}

	void myAssert(boolean u, String message) {
		if (!u) {
			throw new Error("Assertion failed!!! " + message);
		}
	}

	int inBounds(int x, int l, int r, String name) {
		myAssert(l <= x && x <= r, name + " not in bounds!!! " + x
				+ " not in [" + l + ".." + r + "]");
		return x;
	}

	String FNAME = "olympic";

	private void solve() throws IOException {
		int n = inBounds(nextInt(), 1, 100, "n");
		HashMap<String, Country> hm = new HashMap<String, Country>();
		while (n-- > 0) {
			for (int i = 0; i < 3; i++) {
				String name = nextToken();
				if (!hm.containsKey(name)) {
					hm.put(name, new Country(name));
				}
				hm.get(name).a[i]++;
			}
		}
		Country winner = null;
		for (Country c : hm.values()) {
			if (winner == null || winner.compareTo(c) > 0) {
				winner = c;
			}
		}
		out.println(winner.name);
	}

	class Country implements Comparable<Country> {
		public Country(String name2) {
			name = name2;
			a = new int[3];
		}

		String name;
		int[] a;

		@Override
		public int compareTo(Country o) {
			for (int i = 0; i < a.length; i++) {
				if (a[i] != o.a[i]) {
					return o.a[i] - a[i];
				}
			}
			return name.compareTo(o.name);
		}
	}
}
