#include <bits/stdc++.h>
using namespace std;
long long OO = 100000;
bool pred(const std::pair<std::string, int>& lhs,
          const std::pair<std::string, int>& rhs) {
  return lhs.second < rhs.second;
}
int main() {
  int n;
  cin >> n;
  map<string, int> mp;
  string s;
  cin >> s;
  vector<int> v;
  for (int i = 0; i < s.length() - 1; i++) {
    string x = "";
    x += (s[i]);
    x += s[i + 1];
    mp[x]++;
  }
  cout << max_element(mp.begin(), mp.end(), pred)->first;
}
