#include <bits/stdc++.h>
using namespace std;
vector<int> adj[55];
int deg[55];
int dep[55];
int cnt[55];
int main() {
  int n;
  while (scanf("%d", &n) == 1) {
    int lim = (n * (n - 1)) / 2, i, j, k, u, v, f[3], t = 0, now, end, lev;
    for (i = 0; i < lim - 1; i++) {
      scanf("%d%d", &u, &v);
      adj[u].push_back(v);
      deg[v]++;
      cnt[u]++, cnt[v]++;
    }
    queue<int> Q;
    for (i = 1; i <= n; i++) {
      if (cnt[i] != n - 1) f[t++] = i;
      if (deg[i] == 0) {
        Q.push(i);
        Q.push(1);
        dep[i] = 1;
      }
    }
    while (!Q.empty()) {
      now = Q.front();
      Q.pop();
      lev = Q.front();
      Q.pop();
      for (i = 0; i < (int)adj[now].size(); i++) {
        end = adj[now][i];
        deg[end]--;
        if (deg[end] == 0) {
          dep[end] = lev + 1;
          Q.push(end);
          Q.push(lev + 1);
        }
      }
    }
    if (dep[f[0]] < dep[f[1]])
      cout << f[0] << " " << f[1] << endl;
    else
      cout << f[1] << " " << f[0] << endl;
  }
  return 0;
}
