#include <bits/stdc++.h>
using namespace std;
const int MAXN = 51;
bool bigger[MAXN][MAXN];
int a[MAXN];
int cnt[MAXN];
int n, tot;
void Floyd() {
  for (int k = 1; k <= n; k++)
    for (int i = 1; i <= n; i++)
      for (int j = 1; j <= n; j++)
        bigger[i][j] = bigger[i][j] || bigger[i][k] && bigger[k][j];
  return;
}
int main() {
  int ans[2], alen;
  scanf("%d", &n);
  tot = n * (n - 1) / 2;
  for (int i = 0; i < tot - 1; i++) {
    int a, b;
    scanf("%d%d", &a, &b);
    bigger[a][b] = true;
    cnt[a]++;
    cnt[b]++;
  }
  Floyd();
  for (int i = 0; i < n; i++) a[i] = i + 1;
  alen = 0;
  for (int i = 0; i < n; i++)
    if (cnt[a[i]] != n - 1) ans[alen++] = a[i];
  if (bigger[ans[0]][ans[1]])
    printf("%d %d\n", ans[0], ans[1]);
  else
    printf("%d %d\n", ans[1], ans[0]);
  return 0;
}
