#include <bits/stdc++.h>
const double eps = 1e-8;
const double pi = 3.1415926535897932;
const long long I64M = 1000000LL * 1000000LL * 1000000LL;
using namespace std;
int main(int argc, char** argv) {
  int n, m, ans = 0;
  cin >> n;
  m = n * (n - 1) / 2 - 1;
  vector<vector<bool> > Gr(n + 1, vector<bool>(n + 1));
  while (m--) {
    int a, b;
    cin >> a >> b;
    Gr[a][b] = true;
  }
  int f, s;
  for (int i = 1; i <= n; i++)
    for (int j = i + 1; j <= n; j++)
      if (Gr[i][j] == Gr[j][i]) {
        f = i;
        s = j;
        break;
      }
  for (int i = 1; i <= n; i++) {
    if (f != i && s != i) {
      if (Gr[f][i] && !Gr[s][i]) {
        cout << f << ' ' << s;
        return 0;
      } else if (Gr[i][f] && Gr[s][i]) {
        cout << s << ' ' << f;
        return 0;
      }
    }
  }
  cout << f << ' ' << s;
  return 0;
}
