#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e9;
const long long N = 5e1 + 5;
const long long mod = 1e9 + 7;
const long double eps = 1E-7;
int a[N];
int n, x, y;
bool k[N][N];
vector<int> g[N];
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n;
  for (int i = 1; i < n * (n - 1) / 2; i++) {
    cin >> x >> y;
    k[x][y] = true;
    a[x]++, a[y]++;
  }
  x = y = false;
  for (int i = 1; i <= n; i++) {
    if (a[i] == n - 2) {
      if (x == 0)
        x = i;
      else
        y = i;
    }
  }
  for (int i = 1; i <= n; i++) {
    if (i == x or i == y) continue;
    if (k[x][i] > k[y][i]) {
      cout << x << " " << y;
      return 0;
    } else if (k[x][i] < k[y][i]) {
      cout << y << " " << x;
      return 0;
    }
  }
  cout << x << " " << y << endl;
}
