#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100 * 100;
pair<char, char> p[MAXN + 10];
int arr[MAXN + 10];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  string str;
  cin >> str;
  int _max = 0;
  int ans = 0;
  int j = 0;
  for (int i = 0; i < n - 1; i++) {
    bool b = true;
    for (j = 0; j < i; j++) {
      if (str[i] == p[j].first && str[i + 1] == p[j].second) {
        b = false;
        arr[j]++;
        if (arr[j] > _max) {
          _max = arr[j];
          ans = j;
        }
      }
    }
    if (b) {
      p[i].first = str[i];
      p[i].second = str[i + 1];
    }
  }
  cout << p[ans].first << p[ans].second << endl;
}
