#include <bits/stdc++.h>
using namespace std;
const int N = 1e9 + 7;
int iin() {
  int x;
  cin >> x;
  return x;
}
long long lin() {
  long long x;
  cin >> x;
  return x;
}
double din() {
  double x;
  cin >> x;
  return x;
}
int cnt(int arr[], int n, int x) {
  int c = 0;
  for (int i = 0; i < n; i++) {
    if (arr[i] == x) c++;
  }
  return c;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n = iin();
  int k = n * (n - 1) / 2 - 1;
  int a[2 * k], b[k], c[k];
  for (int i = 0; i < k; i++) {
    cin >> b[i] >> c[i];
  }
  vector<int> d;
  set<int> e;
  for (int i = 0; i < k; i++) {
    a[i] = b[i];
    e.insert(a[i]);
  }
  for (int i = 0; i < k; i++) {
    a[k + i] = c[i];
    e.insert(a[k + i]);
  }
  for (auto itr = e.begin(); itr != e.end(); ++itr) {
    if (cnt(a, 2 * k, *itr) == n - 2) {
      d.push_back(*itr);
    }
  }
  int x = cnt(b, k, d[0]);
  int y = cnt(b, k, d[1]);
  if (x > y) {
    cout << d[0] << " " << d[1] << endl;
  } else {
    cout << d[1] << " " << d[0] << endl;
  }
  return 0;
}
