#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a[1500], b[1500], i, j, was[51];
  cin >> n;
  for (i = 1; i <= n; i++) {
    was[i] = 0;
  }
  for (i = 0; i < (n * (n - 1) / 2 - 1); i++) {
    cin >> a[i] >> b[i];
    was[a[i]]++;
    was[b[i]]++;
  }
  int w1 = 0, w2 = 0;
  for (i = 1; i <= n; i++) {
    if (!w1 && was[i] < n - 1) {
      w1 = i;
      was[i]++;
    }
    if (was[i] < n - 1) w2 = i;
  }
  int w1_win = 0;
  for (i = 0; i < (n * (n - 1) / 2 - 1); i++) {
    if (a[i] == w1) w1_win++;
  }
  int w2_win = 0;
  for (i = 0; i < (n * (n - 1) / 2 - 1); i++) {
    if (a[i] == w2) w2_win++;
  }
  if (w1_win > w2_win)
    cout << w1 << " " << w2 << endl;
  else
    cout << w2 << " " << w1 << endl;
  return 0;
}
