#include <bits/stdc++.h>
using namespace std;
const int MAX = 1250;
int n, x[MAX], y[MAX], w[51], l[51];
int msx = -1, msy = -1;
vector<int> ord;
int main() {
  ord.resize(51);
  scanf("%d", &n);
  for (int i = 0; i < n * (n - 1) / 2 - 1; i++) {
    scanf("%d%d", &x[i], &y[i]);
    w[x[i]]++;
    l[y[i]]++;
  }
  for (int i = 1; i <= n && (msx == -1 || msy == -1); i++)
    if (w[i] + l[i] != n - 1) {
      if (msx == -1)
        msx = i;
      else if (msy == -1)
        msy = i;
    }
  for (int i = 0; i < n * (n - 1) / 2 - 1; i++) ord[x[i]] += w[y[i]] + 1;
  if (ord[msy] > ord[msx]) swap(msy, msx);
  printf("%d %d\n", msx, msy);
  return 0;
}
