#include <bits/stdc++.h>
using namespace std;
bool adj[52][52] = {}, vis[52] = {};
int n, s = 0, d = 0;
bool flag = false;
void dfs(int x) {
  if (x == d) {
    cout << s << " " << d << endl;
    flag = true;
    return;
  }
  vis[x] = 1;
  for (int i = 1; i <= n; i++) {
    if (!vis[i] && adj[x][i]) dfs(i);
    if (flag) return;
  }
}
int main() {
  int t, tt;
  cin >> n;
  int m = n * (n - 1) / 2;
  int num[52] = {};
  for (int i = 0; i < m - 1; i++) {
    cin >> t >> tt;
    adj[t][tt] = 1;
    num[t]++;
    num[tt]++;
  }
  for (int i = 1; i <= n; i++) {
    if (num[i] != n - 1) {
      if (!s)
        s = i;
      else
        d = i;
    }
  }
  dfs(s);
  if (!flag) cout << d << " " << s << endl;
  return 0;
}
