#include <bits/stdc++.h>
using namespace std;
int mp[100][100];
int cnt[100];
int main() {
  int n, x, y;
  cin >> n;
  while (cin >> x) {
    cin >> y;
    mp[x][y] = 1;
    mp[y][x] = 1;
    cnt[x]++;
  }
  for (int i = 1; i <= n; i++) {
    for (int j = i + 1; j <= n; j++) {
      if (!mp[i][j]) {
        if (cnt[i] > cnt[j])
          cout << i << " " << j;
        else
          cout << j << " " << i;
        return 0;
      }
    }
  }
}
