#include <bits/stdc++.h>
using namespace std;
const int N = 51;
int result[N][N];
int n;
int cnt[N];
int A, B, C;
int main() {
  cin >> n;
  for (int i = 1; i <= n * (n - 1) / 2 - 1; i++) {
    int x, y;
    cin >> x >> y;
    result[x][y] = 1;
    result[y][x] = -1;
    cnt[x]++;
    cnt[y]++;
  }
  int win;
  for (int i = 1; i <= n; i++)
    if (cnt[i] == n - 2) A = i;
  for (int i = 1; i <= n; i++)
    if (cnt[i] == n - 2 && i != A) B = i;
  win = A;
  for (int i = 1; i <= n; i++)
    if (result[i][A] != result[i][B]) {
      if (result[i][A] == 1) {
        win = A;
      } else
        win = B;
    }
  if (win == B)
    cout << A << " " << B;
  else
    cout << B << " " << A;
}
