#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<vector<int>> a(n + 1, vector<int>(n + 1));
  for (int i = 1; i < n + 1; i++) {
    a[i][i] = -1;
  }
  for (int i = 0; i < (n * (n - 1) / 2 - 1); i++) {
    int x, y;
    cin >> x >> y;
    a[x][y] = x;
    a[y][x] = x;
  }
  int x, y;
  n++;
  for (int i = 1; i < n; i++) {
    bool flag = 0;
    for (int j = 1; j < n; j++) {
      if (a[i][j] == 0) {
        x = i, y = j;
        flag = 1;
        break;
      }
    }
    if (flag) break;
  }
  bool flag = 1;
  for (int i = 1; i < n; i++) {
    if (i != x && i != y) {
      if (!((a[i][x] == x) == (a[i][y] == y))) {
        if (a[i][x] == x)
          cout << x << " " << y << '\n';
        else
          cout << y << " " << x << '\n';
        flag = 0;
        break;
      }
    }
  }
  if (flag) cout << x << " " << y << '\n';
}
