#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
void solve() {
  int n;
  cin >> n;
  map<pair<int, int>, bool> m, m1;
  for (int i = 0; i < n * (n - 1) / 2 - 1; i++) {
    int x, y;
    cin >> x >> y;
    m1[{x, y}] = 1;
    if (x > y) swap(x, y);
    m[{x, y}] = 1;
  }
  for (int i = 1; i <= n; i++) {
    for (int j = i + 1; j <= n; j++) {
      if (m[{i, j}] == 0) {
        int cnt1 = 0, cnt2 = 0;
        for (int k = 1; k <= n; k++) {
          cnt1 += (m1[{i, k}]);
          cnt2 += (m1[{j, k}]);
        }
        if (cnt1 < cnt2) swap(i, j);
        cout << i << ' ' << j << endl;
        return;
      }
    }
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int T = 1;
  while (T--) solve();
}
