#include <bits/stdc++.h>
using namespace std;
const long long mxN = 52;
vector<long long> adj[mxN];
signed main() {
  long long n;
  cin >> n;
  long long x = (n * (n - 1)) / 2;
  long long a[x - 1][2];
  for (long long i = 0; i < x - 1; i++) {
    cin >> a[i][0] >> a[i][1];
    adj[a[i][0]].push_back(a[i][1]);
    adj[a[i][1]].push_back(a[i][0]);
  }
  long long ans1 = -1, ans2 = -1;
  for (long long i = 1; i <= n; i++) {
    if (ans1 == -1 && adj[i].size() < n - 1) {
      ans1 = i;
    } else if (ans2 == -1 && adj[i].size() < n - 1) {
      ans2 = i;
    }
  }
  for (long long i = 1; i <= n; i++) {
    if (i == ans1 || i == ans2) {
      continue;
    } else {
      long long w1 = -1, w2 = -1;
      for (long long j = 0; j < x - 1; j++) {
        if (a[j][0] == ans1 && a[j][1] == i) {
          w1 = ans1;
        } else if (a[j][0] == i && a[j][1] == ans1) {
          w1 = i;
        } else if (a[j][0] == ans2 && a[j][1] == i) {
          w2 = ans2;
        } else if (a[j][0] == i && a[j][1] == ans2) {
          w2 = i;
        }
      }
      if (w1 == ans1 && w2 != ans2) {
        cout << ans1 << " " << ans2 << endl;
        return 0;
      } else if (w2 == ans2 && w1 != ans1) {
        cout << ans2 << " " << ans1 << endl;
        return 0;
      }
    }
  }
  cout << ans1 << " " << ans2 << endl;
}
