#include <bits/stdc++.h>
void solve() {
  int n;
  int g[64][64] = {0};
  std::cin >> n;
  int m = n * (n - 1) / 2 - 1;
  for (int i = 0; i < m; ++i) {
    int x, y;
    std::cin >> x >> y;
    g[x][y] = 1;
    g[y][x] = -1;
  }
  int a = 0, b = 0;
  for (int i = 1; i <= n; ++i) {
    for (int j = i + 1; j <= n; ++j) {
      if (!g[i][j]) {
        a = i;
        b = j;
      }
    }
  }
  for (int c = 1; c <= n; ++c) {
    if (c == a || c == b) continue;
    if (!g[a][c] || !g[c][b]) continue;
    if (g[a][c] == 1 && g[c][b] == 1) {
      std::cout << a << ' ' << b << '\n';
      return;
    }
    if (g[a][c] == -1 && g[c][b] == -1) {
      std::cout << b << ' ' << a << '\n';
      return;
    }
  }
  std::cout << a << ' ' << b << '\n';
}
int main(int argc, char* argv[]) {
  ::std::ios::sync_with_stdio(false);
  solve();
  return 0;
}
