#include <bits/stdc++.h>
using namespace std;
int deg[55];
int in[55];
int g[55][55];
int st[55];
int n;
bool topo() {
  int top = -1;
  for (int i = 1; i <= n; i++)
    if (in[i] == 0) st[++top] = i;
  for (int i = 0; i < n; i++) {
    if (top == -1) return false;
    int x = st[top--];
    for (int i = 1; i <= n; i++) {
      if (g[x][i]) {
        in[i]--;
        if (in[i] == 0) st[++top] = i;
      }
    }
  }
  return true;
}
int main() {
  memset(deg, 0, sizeof deg);
  memset(g, 0, sizeof g);
  memset(in, 0, sizeof in);
  int x, y;
  scanf("%d", &n);
  for (int i = 0; i < n * (n - 1) / 2 - 1; i++) {
    scanf("%d %d", &x, &y);
    g[x][y] = 1;
    in[y]++;
    deg[x]++;
    deg[y]++;
  }
  int fir = -1, sec = -1;
  for (int i = 1; i <= n; i++)
    if (deg[i] != n - 1)
      if (fir == -1)
        fir = i;
      else
        sec = i;
  in[sec]++;
  g[fir][sec] = 1;
  if (topo())
    printf("%d %d\n", fir, sec);
  else
    printf("%d %d\n", sec, fir);
  return 0;
}
