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

const
  MAXN = 100;
  MAXLEN = 200;

var
  name : array[1..3*MAXN] of string;
  count : array[1..3*MAXN, 1..3] of integer;
  num, last, i, j, k, kk, n, m, t : integer;
  ts, s, tname : string;
  equal : boolean;

begin
  reset(input, 'olympic.in');
  rewrite(output, 'olympic.out');
  readln(n);
  assert((1 <= n) and (n <= MAXN));

  m := 0;
  for i := 1 to n do begin
    readln(s);
    assert(length(s) <= MAXLEN);
    j := 1;
    for kk := 1 to 3 do begin
      while (s[j] = ' ') do begin
        j := j + 1;
      end;
      last := j;
      while (j <= length(s)) and (s[j] <> ' ') do begin
        j := j + 1;
      end;
      tname := copy(s, last, j - last);
      num := -1;
      for k := 1 to m do begin
        if (name[k] = tname) then begin
          num := k;
        end;
      end;
      if (num = -1) then begin
        m := m + 1;
        name[m] := tname;
        num := m;
      end;
      count[num][kk] := count[num][kk] + 1;
    end;
  end;

  for i := 1 to n do begin
    for j := i + 1 to n do begin
      equal := true;
      for k := 1 to 3 do begin
        if (count[j][k] > count[i][k]) then begin
          for kk := 1 to 3 do begin
            t := count[j][kk];
            count[j][kk] := count[i][kk];
            count[i][kk] := t;
          end;
          ts := name[j];
          name[j] := name[i];
          name[i] := ts;
          equal := false;
          break;
        end else if (count[j][k] < count[i][k]) then begin
          equal := false;
          break;
        end;
      end;
      if (equal) and (name[j] < name[i]) then begin
        for kk := 1 to 3 do begin
          t := count[j][kk];
          count[j][kk] := count[i][kk];
          count[i][kk] := t;
        end;
        ts := name[j];
        name[j] := name[i];
        name[i] := ts;
      end;
    end;
  end;
  writeln(name[1]);
end.
