Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

var scanner = bufio.NewScanner(os.Stdin)

func nextString() string {
	scanner.Scan()
	return scanner.Text()
}

func nextInt() (int, error) {
	return strconv.Atoi(nextString())
}

type Pair struct {
	key   int
	value int
}

func main() {
	scanner.Split(bufio.ScanWords)

	counts := map[int]int{}
	for {
		n, err := nextInt()
		if err != nil {
			break
		}

		counts[n]++
	}

	pairs := []Pair{}
	for k, v := range counts {
		pairs = append(pairs, Pair{k, v})
	}
	sort.Slice(pairs, func(i, j int) bool {
		if pairs[i].value == pairs[j].value {
			return pairs[i].key < pairs[j].key
		}
		return pairs[i].value > pairs[j].value
	})

	vMax := 0
	for _, pair := range pairs {
		if vMax != 0 && vMax != pair.value {
			break
		}
		if pair.value > vMax {
			vMax = pair.value
		}
		fmt.Println(pair.key)
	}
}

C++: #define _USE_MATH_DEFINES
#include<iostream>
#include<string>
#include<queue>
#include<cmath>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<functional>
#include<algorithm>
#include<stack>
#include<cstdio>
#include<bitset>
#include<unordered_map>
#include<climits>
#include<fstream>
using namespace std;
///////////////////library zone!!!!!!!!!!!!!!!!!!!!!!!!!!!!
typedef long long ll;
typedef long double ld;
#define all(a) (a).begin(),(a).end()
#define EPS (1e-7)
const ll Mod = 1000000007;
const ll mod = 998244353;
struct H {
	ll x, y;
	bool operator<(const H &b) const {
		if (x != b.x) return x < b.x;
		return y < b.y;
	}
	bool operator>(const H &b) const {
		if (x != b.x) return x > b.x;
		return y > b.y;
	}
	bool operator==(const H &b) const { return x == b.x&&y == b.y; }
	bool operator!=(const H &b) const { return (*this) != b; }
};
struct P {
	ll pos, cost;
	bool operator<(const P &b) const { return cost < b.cost; }
	bool operator>(const P &b) const { return cost > b.cost; }
};
struct B {
	ll to, cost;
};
struct E {
	ll from, to, cost;
	bool operator<(const E &b) const { return cost < b.cost; }
	bool operator>(const E &b) const { return cost > b.cost; }
};
template<typename T, typename U>
void chmin(T &a, U b) {
	if (a > b) a = b;
}
template<typename T, typename U>
void chmax(T &a, U b) {
	if (a < b) a = b;
}
template<typename T>
T max_0(T a) {
	if (a < 0) return 0;
	return a;
}
template<typename T>
T min_0(T a) {
	if (a > 0) return 0;
	return a;
}
ll read() {
	ll u;
	ll k = scanf("%lld", &u);
	return u;
}
ll gcd(ll i, ll j) {
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcd(j%i, i);
}
ll mod_pow(ll x, ll n, ll p) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * x % p;
		x = x * x % p;
		n >>= 1;
	}
	return res;
}//x^n%p
vector<string>split(string s, char c = ' ') {
	vector<string>vec;
	string h = "";
	for (int i = 0; i < s.size();) {
		int j = i;
		while (j < s.size() && s[j] != ' ') {
			h += s[j++];
		}
		if (h.size() > 0) vec.push_back(h);
		h = "";
		i = j + 1;
	}
	return vec;
}
const ll Inf = 3023372036854775807;
const int inf = 1500000000;
#define int long long
//----------------------------------------------------
class Vec2 {
public:
	ld x, y;
	Vec2() { x = 0, y = 0; }
	Vec2(ld x, ld y) :x(x), y(y) {}
	ld length() {
		return sqrt(x*x + y * y);
	}
	Vec2 normal() {
		ld len = this->length();
		if (len == 0) return Vec2(x, y);
		x /= len, y /= len;
		return *(this);
	}
	Vec2 operator+(Vec2 vec) {
		return Vec2(x + vec.x, y + vec.y);
	}
	Vec2 operator-(Vec2 vec) {
		return Vec2(x - vec.x, y - vec.y);
	}
	template<typename T>
	Vec2 operator*(T cons) {
		return Vec2(x*cons, y*cons);
	}
	ld operator*(Vec2 vec) {
		return x * vec.x + y * vec.y;
	}
	ld operator%(Vec2 vec) {
		return x * vec.y - y * vec.x;
	}
	bool operator==(Vec2 vec) {
		return abs(x - vec.x) < EPS && abs(y - vec.y) < EPS;
	}
};
ld dot(Vec2 a, Vec2 b) {
	return a.x*b.x + a.y*b.y;
}
ld cross(Vec2 a, Vec2 b) {
	return a.x*b.y - a.y*b.x;
}
ld areaIntegral(Vec2 a, Vec2 b) {
	return abs(a.x*b.y - a.y*b.x) / 2.0;
}
class Vec3 {
public:
	ld x, y, z;
	Vec3() { x = 0, y = 0, z = 0; }
	Vec3(ld x, ld y, ld z) :x(x), y(y), z(z) {}
	ld length() {
		return sqrt(x*x + y * y + z * z);
	}
	void normal() {
		ld len = this->length();
		if (len == 0) return;
		x /= len, y /= len, z /= len;
	}
	Vec3 operator+(Vec3 vec) {
		return Vec3(x + vec.x, y + vec.y, z + vec.z);
	}
	Vec3 operator-(Vec3 vec) {
		return Vec3(x - vec.x, y - vec.y, z - vec.z);
	}
	Vec3 operator*(int cons) {
		return Vec3(x*cons, y*cons, z*cons);
	}
	ld operator*(Vec3 vec) {
		return x * vec.x + y * vec.y + z * vec.z;
	}
};
ld dot(Vec3 a, Vec3 b) {
	return a.x*b.x + a.y*b.y + a.z*b.z;
}
class Line {
public:
	Vec2 from, to;
	Line(Vec2 from, Vec2 to) :from(from), to(to) {}
};
Line getPerpendicularBisector(Line line) {
	int cx = (line.from.x + line.to.x) / 2, cy = (line.from.y + line.to.y) / 2;
	Vec2 p = Vec2(cx + (line.from.y - line.to.y), cy + (line.to.x - line.from.x));
	return Line(Vec2(cx, cy), p);
}
int a[200];
signed main() {
	int x;
	while (cin >> x&&x) {
		a[x]++;
	}
	vector<int>ans;
	int sum = 0;
	for (int i = 1; i <= 100; i++) {
		if (a[i] > sum) {
			ans.clear();
			ans.push_back(i);
			sum = a[i];
		}
		else if (a[i] == sum) {
			ans.push_back(i);
		}
	}
	for (int i = 0; i < ans.size(); i++) {
		cout << ans[i] << endl;
	}
}

C++: #include<iostream>
using namespace std;

int main(){
  int a,n;
  int my_array[101]={};
  
  
  while(cin>>a){
    my_array[a]++;
  }
  int b=0;
  for(n=1;n<=100;n++){
    if(b>my_array[n])
      b=my_array[n];
  }
  for(int c=0;c<=100;c++){
    if(b==my_array[c])
      cout<<c<<endl;
  }
      
   return 0;
}

C++: #include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <functional>
#include <set>
#include <sstream>
#include <map>
 
using namespace std;
 
const double eps=1e-10;
 
int main()
{
	int c[101]={0};
	int fre=0;

	int d;
	while(cin>>d){
		c[d]++;
		fre=max(fre,c[d]);
	}

	for(int i=1;i<=100;i++){
		if(c[i]==fre) cout<<i<<endl;
	}


	return 0;
}

C++: #include<iostream>
#include<iomanip>
#include<vector>
#include<queue>
#include<list>
#include<stack>
#include<algorithm>
#include<cmath>
#include<memory>
#include<array>

using namespace std;

int main()
{
  array<int,101> a{};
  int d;

  while ( cin >> d )
    ++a[d];

  int mx = 0;

  for ( auto i = 1; i <= 100; ++i )
    if ( mx < a[i] ) mx = a[i];

  for ( auto i = 1; i <= 100; ++i )
    if ( a[i] == mx ) cout << i << endl;

  return 0;
}

C++: #include <iostream>
#include <algorithm>

using namespace std;

int main()
{
	int num[100] = {0};
	int n;
	int M = 0, ct = 0;
	
	while (cin >> n){
		num[n]++;
		ct++;
		M = max(M, num[n]);
	}
	
	for (int i = 0; i < ct; i++){
		if (M == num[i]){
			cout << i << endl;
		}
	}
	return (0);
}

C++: #include <iostream>
#include <map>

using namespace std;

void solve()
{
	map<int, int> Map;
	int n;
	while(cin >> n, n)
	{
		++Map[n];
	}
	int Max = 0;
	for(map<int, int>::iterator Ite = Map.begin(); Ite != Map.end(); ++Ite)
	{
		if(Max < Ite->second)
		{
			Max = Ite->second;
		}
	}
	for(map<int, int>::iterator Ite = Map.begin(); Ite != Map.end(); ++Ite)
	{
		if(Ite->second == Max)
		{
			cout << Ite->first << endl;
		}
	}
}

int main()
{
	solve();
	return(0);
}

C++: #include<iostream>
#include<cstdlib>
using namespace std;
int compare(const void *a,const void *b){
	return *(int *)a-*(int *)b;
}
int main(){
	int n,a[200][2],k=0,b[200],max=0,d=0,i;
	for(i=0;i<200;i++)
	a[i][1]=0;
	while(cin>>n){
		for(i=0;i<k;i++)
		if(a[i][0]==n){
			a[i][1]++;
			break;
		}
		if(i==k){
			a[k][0]=n;
			a[k++][1]++;
		}
	}
	for(i=0;i<k;i++)
		if(a[i][1]>max)
			max=a[i][1];
	for(i=0;i<k;i++)
		if(max==a[i][1])
			b[d++]=a[i][0];
	qsort(b,d,sizeof(int),compare);
	for(i=0;i<d;i++)
		cout<<b[i]<<endl;
	return 0;
}