#include <bits/stdc++.h>
using namespace std;
map<pair<int, int>, bool> t;
vector<vector<int>> g(52);
vector<bool> vis(52);
pair<int, int> a;
bool m;
void dfs(int i) {
  if (!vis[i]) {
    vis[i] = true;
    for (int j = 0; j < g[i].size(); j++) {
      if (g[i][j] == a.second) {
        m = true;
      }
      dfs(g[i][j]);
    }
  }
}
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n * (n - 1) / 2 - 1; i++) {
    int x, y;
    cin >> x >> y;
    g[x].push_back(y);
    t[make_pair(x, y)] = true;
  }
  long long j = 4;
  long long k = 2;
  for (int i = 0; i < n * (n - 1) / 2; i++) {
    if (!(t[make_pair(__builtin_ctzll(j), __builtin_ctzll(k))] ||
          t[make_pair(__builtin_ctzll(k), __builtin_ctzll(j))])) {
      a = make_pair(__builtin_ctzll(j), __builtin_ctzll(k));
    }
    if (k << 1 != j) {
      k <<= 1;
    } else {
      j <<= 1;
      k = 2;
    }
  }
  dfs(a.first);
  if (!m) {
    cout << a.second << " " << a.first << "\n";
  } else {
    cout << a.first << " " << a.second << "\n";
  }
  return 0;
}
