#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long n;
  cin >> n;
  vector<pair<long long, long long>> v((n * (n - 1)) / 2);
  map<long long, long long> ma;
  for (long long i = 0; i < ((n * (n - 1)) / 2) - 1; i++) {
    cin >> v[i].first >> v[i].second;
    ma[v[i].first] += 1;
    ma[v[i].second] += 1;
  }
  long long x = -1, y = -1;
  map<long long, long long>::iterator it;
  for (it = ma.begin(); it != ma.end(); it++) {
    if (it->second < n - 1 && x == -1)
      x = it->first;
    else if (it->second < n - 1 && x != -1) {
      y = it->first;
      break;
    }
  }
  long long c1 = 0, c2 = 0;
  for (long long i = 0; i < ((n * (n - 1)) / 2) - 1; i++) {
    if (x == v[i].first)
      c1 += 1;
    else if (y == v[i].first)
      c2 += 1;
  }
  if (c1 >= c2)
    cout << x << " " << y;
  else
    cout << y << " " << x;
};
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  solve();
  return 0;
}
