Language: C++

using System;
using System.Linq;
using System.Text.RegularExpressions;
using System.Collections.Generic;
using static program.Input;
using static program.MyMath;
using static System.Console;
using static program.Const;

namespace program
{
  public class PriorityQueue
    {
    private string[] _heap;
    private int _sz = 0;
    private int _count = 0;
    public PriorityQueue()
    {
      _heap = new string[200000];
    }
    public void Push(string x)
    {
      _count++;
      var i = _sz++;
      while (i > 0)
      {
        var p = (i - 1) / 2;
        if (string.Compare(_heap[p], x) <= 0) break;
        _heap[i] = _heap[p];
        i = p;
      }
      _heap[i] = x;
    }

    public string Pop()
    {
      _count--;

      string ret = _heap[0];
      string x = _heap[--_sz];

      int i = 0;
      while (i * 2 + 1 < _sz)
      {
        int a = i * 2 + 1;
        int b = i * 2 + 2;

        if (b < _sz && string.Compare(_heap[b], _heap[a]) < 0) a = b;

        if (string.Compare(_heap[a], x) >= 0) break;

        _heap[i] = _heap[a];
        i = a;
      }

      _heap[i] = x;

      return ret;
    }

    public int Count()
    {
      return _count;
    }

    public string Peek()
    {
      return _heap[0];
    }
  }
  class Program
  {
    static void Main()
    {
      var n = ScanInt();
      var d = new Dictionary<string, int>();
      
      for(int i=0; i<n; i++){
        var s = ScanStr();
        if(d.ContainsKey(s))
          d[s]++;
        else
          d.Add(s,1);
      }
      var f = d.OrderByDescending(_=>_.Value);
      int max =0;
      PriorityQueue p = new PriorityQueue();
      foreach(var h in f){
        if(h.Value < max) break;
        max = h.Value;
        p.Push(h.Key);
      }
      while(p.Count()>0){
        WriteLine(p.Pop());
      }
    }
  }

  static class Const
  {
    public static string alp = "abcdefghijklmnopqrstuvwxyz";
    public static string Alp = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
    public static long MOD = 1000000007;
    public static int INF = int.MaxValue;
    public static long INFL = long.MaxValue;
  }
  static class Input
  {
    static public int ScanInt() { return int.Parse(Console.ReadLine()); }
    static public uint ScanUint() { return uint.Parse(Console.ReadLine()); }
    static public double ScanDouble() { return double.Parse(Console.ReadLine()); }
    static public long ScanLong() { return long.Parse(Console.ReadLine()); }
    static public ulong ScanUlong() { return ulong.Parse(Console.ReadLine()); }
    static public int[] ScanIntArray() { return Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray(); }
    static public uint[] ScanUintArray() { return Console.ReadLine().Split().Select(x => uint.Parse(x)).ToArray(); }
    static public double[] ScanDoubleArray() { return Console.ReadLine().Split().Select(x => double.Parse(x)).ToArray(); }
    static public long[] ScanLongArray() { return Console.ReadLine().Split().Select(x => long.Parse(x)).ToArray(); }
    static public ulong[] ScanUlongArray() { return Console.ReadLine().Split().Select(x => ulong.Parse(x)).ToArray(); }

    static public string ScanStr() { return Console.ReadLine(); }
    static public string[] ScanStrArray() { return ScanStr().Split(); }
    static public string RegaxReplace(this string arg1, string pattern, string replacement) { return Regex.Replace(arg1, pattern, replacement); }
    static public string Join<T>(this IEnumerable<T> source, string separator) { return string.Join(separator, source); }
  }

  static class MyMath
  {
    static public int Floor2(this int a)
    {
      int N = 1;
      while (N < a) N *= 2;
      return N / 2;
    }
    static public long Floor2(this long a)
    {
      long N = 1;
      while (N < a) N *= 2;
      return N / 2;
    }
    static public int Ceiling2(this int a)
    {
      int N = 1;
      while (N < a) N *= 2;
      return N;
    }
    static public long Ceiling2(this long a)
    {
      long N = 1;
      while (N < a) N *= 2;
      return N;
    }
    static public long[] CumSum(this long[] a)
    {
      var res = new long[a.Length];
      long s = 0;
      for (int i = 0; i < a.Length; i++) res[i] = (s += a[i]);
      return res;
    }
    static public IEnumerable<int> PrimeFactors(this int n)
    {
      int tmp = n;
      for (int i = 2; i * i <= n; i++)
      {
        while (tmp % i == 0)
        {
          tmp /= i;
          yield return i;
        }
      }
      if (tmp != 1) yield return tmp;
    }
    static public IEnumerable<long> PrimeFactors(this long n)
    {
      var tmp = n;
      for (long i = 2; i * i <= n; i++)
      {
        while (tmp % i == 0)
        {
          tmp /= i;
          yield return i;
        }
      }
      if (tmp != 1) yield return tmp;
    }
    static public int Digit(this int n, int d) { if (d < 0) return 0; return (n % (int)Math.Pow(10, d + 1)) / (int)Math.Pow(10, d); }
    static public int Length(this int n) { if (n < 0) return 0; return (int)Math.Log10(n) + 1; }
    static public int Top(this int n) { return n.Digit(n.Length() - 1); }
    public static bool isPrime(this int p)
    {
      if (p <= 1) return false;
      for (int i = 2; i * i <= p; i++)
        if (p % i == 0) return false;
      return true;
    }
    public static bool isPrime(this long p)
    {
      if (p <= 1) return false;
      for (long i = 2; i * i <= p; i++)
        if (p % i == 0) return false;
      return true;
    }
    public static int GCD(int a, int b)
    {
      Func<int, int, int> gcd = null;
      gcd = (x, y) => y == 0 ? x : gcd(y, x % y);
      return a > b ? gcd(a, b) : gcd(b, a);
    }
    public static long GCD(long a, long b)
    {
      Func<long, long, long> gcd = null;
      gcd = (x, y) => y == 0 ? x : gcd(y, x % y);
      return a > b ? gcd(a, b) : gcd(b, a);
    }
    public static ulong extGCD(ulong a, ulong b, ref ulong x, ref ulong y)
    {
      if (b == 0)
      {
        x = 1;
        y = 0;
        return a;
      }
      var d = extGCD(b, a % b, ref y, ref x);
      y -= a / b * x;
      return d;
    }
    public static int LCM(int a, int b) { return a * b / GCD(a, b); }
    public static long LCM(long a, long b) { return a * b / GCD(a, b); }
    public static long Inv(this long a, long m = 1000000007)
    {
      long b = m, u = 1, v = 0;
      while (b != 0)
      {
        long t = a / b;
        a -= t * b;
        swap(ref a, ref b);
        u -= t * v;
        swap(ref u, ref v);
      }
      u %= m;
      if (u < 0) u += m;
      return u;
    }
    private static void swap(ref long a, ref long b)
    {
      var t = a;
      a = b;
      b = t;
    }
  }


}


Compiler output:
a.cc:1:7: error: expected nested-name-specifier before 'System'
    1 | using System;
      |       ^~~~~~
a.cc:2:7: error: expected nested-name-specifier before 'System'
    2 | using System.Linq;
      |       ^~~~~~
a.cc:3:7: error: expected nested-name-specifier before 'System'
    3 | using System.Text.RegularExpressions;
      |       ^~~~~~
a.cc:4:7: error: expected nested-name-specifier before 'System'
    4 | using System.Collections.Generic;
      |       ^~~~~~
a.cc:5:7: error: expected nested-name-specifier before 'static'
    5 | using static program.Input;
      |       ^~~~~~
a.cc:6:7: error: expected nested-name-specifier before 'static'
    6 | using static program.MyMath;
      |       ^~~~~~
a.cc:7:7: error: expected nested-name-specifier before 'static'
    7 | using static System.Console;
      |       ^~~~~~
a.cc:8:7: error: expected nested-name-specifier before 'static'
    8 | using static program.Const;
      |       ^~~~~~
a.cc:12:3: error: expected unqualified-id before 'public'
   12 |   public class PriorityQueue
      |   ^~~~~~
a.cc:97:4: error: expected ';' after class definition
   97 |   }
      |    ^
      |    ;
a.cc: In static member function 'static void program::Program::Main()':
a.cc:75:7: error: 'var' was not declared in this scope
   75 |       var n = ScanInt();
      |       ^~~
a.cc:76:11: error: expected ';' before 'd'
   76 |       var d = new Dictionary<string, int>();
      |           ^
a.cc:78:22: error: 'n' was not declared in this scope
   78 |       for(int i=0; i<n; i++){
      |                      ^
a.cc:79:13: error: expected ';' before 's'
   79 |         var s = ScanStr();
      |             ^
a.cc:80:12: error: 'd' was not declared in this scope
   80 |         if(d.ContainsKey(s))
      |            ^
a.cc:80:26: error: 's' was not declared in this scope
   80 |         if(d.ContainsKey(s))
      |                          ^
a.cc:85:11: error: expected ';' before 'f'
   85 |       var f = d.OrderByDescending(_=>_.Value);
      |           ^
a.cc:87:7: error: 'PriorityQueue' was not declared in this scope
   87 |       PriorityQueue p = new PriorityQueue();
      |       ^~~~~~~~~~~~~
a.cc:88:19: error: expected ')' before 'h'
   88 |       foreach(var h in f){
      |                   ^
a.cc:88:14: note: to match this '('
   88 |       foreach(var h in f){
      |              ^
a.cc:88:7: error: 'foreach' was not declared in this scope
   88 |       foreach(var h in f){
      |       ^~~~~~~
a.cc:93:13: error: 'p' was not declared in this scope
   93 |       while(p.Count()>0){
      |             ^
a.cc:94:9: error: 'WriteLine' was not declared in this scope
   94 |         WriteLine(p.Pop());
      |         ^~~~~~~~~
a.cc: At global scope:
a.cc:101:11: error: expected ':' before 'static'
  101 |     public static string alp = "abcdefghijklmnopqrstuvwxyz";
      |           ^~~~~~~
      |           :
a.cc:101:19: error: 'string' does not name a type
  101 |     public static string alp = "abcdefghijklmnopqrstuvwxyz";
      |                   ^~~~~~
a.cc:102:11: error: expected ':' before 'static'
  102 |     public static string Alp = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
      |           ^~~~~~~
      |           :
a.cc:102:19: error: 'string' does not name a type
  102 |     public static string Alp = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
      |                   ^~~~~~
a.cc:103:11: error: expected ':' before 'static'
  103 |     public static long MOD = 1000000007;
      |           ^~~~~~~
      |           :
a.cc:103:24: error: ISO C++ forbids in-class initialization of non-const static member 'program::Const::MOD'
  103 |     public static long MOD = 1000000007;
      |                        ^~~
a.cc:104:11: error: expected ':' before 'static'
  104 |     public static int INF = int.MaxValue;
      |           ^~~~~~~
      |           :
a.cc:104:29: error: expected primary-expression before 'int'
  104 |     public static int INF = int.MaxValue;
      |                             ^~~
a.cc:104:23: error: ISO C++ forbids in-class initialization of non-const static member 'program::Const::INF'
  104 |     public static int INF = int.MaxValue;
      |                       ^~~
a.cc:104:27: error: expected ';' at end of member declaration
  104 |     public static int INF = int.MaxValue;
      |                           ^
      |                            ;
a.cc:104:32: error: expected unqualified-id before '.' token
  104 |     public static int INF = int.MaxValue;
      |                                ^
a.cc:105:11: error: expected ':' before 'static'
  105 |     public static long INFL = long.MaxValue;
      |           ^~~~~~~
      |           :
a.cc:105:31: error: expected primary-expression before 'long'
  105 |     public static long INFL = long.MaxValue;
      |                               ^~~~
a.cc:105:24: error: ISO C++ forbids in-class initialization of non-const static member 'program::Const::INFL'
  105 |     public static long INFL = long.MaxValue;
      |                        ^~~~
a.cc:105:29: error: expected ';' at end of member declaration
  105 |     public static long INFL = long.MaxValue;
      |                             ^
      |                              ;
a.cc:105:35: error: expected unqualified-id before '.' token
  105 |     public static long INFL = long.MaxValue;
      |                                   ^
a.cc:106:4: error: expected ';' after class definition
  106 |   }
      |    ^
      |    ;
a.cc:99:3: error: a storage class can only be specified for objects and functions
   99 |   static class Const
      |   ^~~~~~
a.cc:109:12: error: expected unqualified-id before 'public'
  109 |     static public int ScanInt() { return int.Parse(Console.ReadLine()); }
      |            ^~~~~~
a.cc:110:12: error: expected unqualified-id before 'public'
  110 |     static public uint ScanUint() { return uint.Parse(Console.ReadLine()); }
      |            ^~~~~~
a.cc:111:12: error: expected unqualified-id before 'public'
  111 |     static public double ScanDouble() { return double.Parse(Console.ReadLine()); }
      |            ^~~~~~
a.cc:112:12: error: expected unqualified-id before 'public'
  112 |     static public long ScanLong() { return long.Parse(Console.ReadLine()); }
      |            ^~~~~~
a.cc:113:12: error: expected unqualified-id before 'public'
  113 |     static public ulong ScanUlong() { return ulong.Parse(Console.ReadLine()); }
      |            ^~~~~~
a.cc:114:12: error: expected unqualified-id before 'public'
  114 |     static public int[] ScanIntArray() { return Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray(); }
      |            ^~~~~~
a.cc:115:12: error: expected unqualified-id before 'public'
  115 |     static public uint[] ScanUintArray() { return Console.ReadLine().Split().Select(x => uint.Parse(x)).ToArray(); }
      |            ^~~~~~
a.cc:116:12: error: expected unqualified-id before 'public'
  116 |     static public double[] ScanDoubleArray() { return Console.ReadLine().Split().Select(x => double.Parse(x)).ToArray(); }
      |            ^~~~~~
a.cc:117:12: error: expected unqualified-id before 'public'
  117 |     static public long[] ScanLongArray() { return Console.ReadLine().Split().Select(x => long.Parse(x)).ToArray(); }
      |            ^~~~~~
a.cc:118:12: error: expected unqualified-id before 'public'
  118 |     static public ulong[] ScanUlongArray() { return Console.ReadLine().Split().Select(x => ulong.Parse(x)).ToArray(); }
      |            ^~~~~~
a.cc:120:12: error: expected unqualified-id before 'public'
  120 |     static public string ScanStr() { return Console.ReadLine(); }
      |            ^~~~~~
a.cc:121:12: error: expected unqualified-id before 'public'
  121 |     static public string[] ScanStrArray() { return ScanStr().Split(); }
      |            ^~~~~~
a.cc:122:12: error: expected unqualified-id before 'public'
  122 |     static public string RegaxReplace(this string arg1, string pattern, string replacement) { return Regex.Replace(arg1, pattern, replacement); }
      |            ^~~~~~
a.cc:123:12: error: expected unqualified-id before 'public'
  123 |     static public string Join<T>(this IEnumerable<T> source, string separator) { return string.Join(separator, source); }
      |            ^~~~~~
a.cc:124:4: error: expected ';' after class definition
  124 |   }
      |    ^
      |    ;
a.cc:107:3: error: a storage class can only be specified for objects and functions
  107 |   static class Input
      |   ^~~~~~
a.cc:128:12: error: expected unqualified-id before 'public'
  128 |     static public int Floor2(this int a)
      |            ^~~~~~
a.cc:134:12: error: expected unqualified-id before 'public'
  134 |     static public long Floor2(this long a)
      |            ^~~~~~
a.cc:140:12: error: expected unqualified-id before 'public'
  140 |     static public int Ceiling2(this int a)
      |            ^~~~~~
a.cc:146:12: error: expected unqualified-id before 'public'
  146 |     static public long Ceiling2(this long a)
      |            ^~~~~~
a.cc:152:12: error: expected unqualified-id before 'public'
  152 |     static public long[] CumSum(this long[] a)
      |            ^~~~~~
a.cc:159:12: error: expected unqualified-id before 'public'
  159 |     static public IEnumerable<int> PrimeFactors(this int n)
      |            ^~~~~~
a.cc:172:12: error: expected unqualified-id before 'public'
  172 |     static public IEnumerable<long> PrimeFactors(this long n)
      |            ^~~~~~
a.cc:185:12: error: expected unqualified-id before 'public'
  185 |     static public int Digit(this int n, int d) { if (d < 0) return 0; return (n % (int)Math.Pow(10, d + 1)) / (int)Math.Pow(10, d); }
      |            ^~~~~~
a.cc:186:12: error: expected unqualified-id before 'public'
  186 |     static public int Length(this int n) { if (n < 0) return 0; return (int)Math.Log10(n) + 1; }
      |            ^~~~~~
a.cc:187:12: error: expected unqualified-id before 'public'
  187 |     static public int Top(this int n) { return n.Digit(n.Length() - 1); }
      |            ^~~~~~
a.cc:188:11: error: expected ':' before 'static'
  188 |     public static bool isPrime(this int p)