#include <bits/stdc++.h>
using namespace std;
int M[52][52];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n * (n - 1) / 2 - 1; i++) {
    int a, b;
    cin >> a >> b;
    a--, b--;
    M[a][b]++;
  }
  int _x = -1, _y = -1, x, y;
  bool enc = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      for (int k = 0; k < n; k++) {
        if ((M[i][j] == 0) && (M[j][i] == 0) && (i != j)) {
          x = i + 1;
          y = j + 1;
        }
        if ((M[i][j] == 1) && (M[j][k] == 1) && (M[i][k] == 0)) {
          _x = i + 1;
          _y = k + 1;
          enc = 1;
        }
      }
    }
  }
  if (enc) {
    cout << _x << " " << _y << endl;
  } else {
    cout << x << " " << y << endl;
  }
}
