#include <bits/stdc++.h>
int INF = 1000000005;
long long INFF = 1000000000000000005LL;
double pi = acos(-1);
int dirx[8] = {-1, 0, 0, 1, -1, -1, 1, 1};
int diry[8] = {0, 1, -1, 0, -1, 1, -1, 1};
using namespace std;
vector<int> v[51];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  int n;
  cin >> n;
  int x = n * (n - 1);
  x = x / 2;
  x--;
  map<int, int> m;
  for (int i = 0; i < x; i++) {
    int a, b;
    cin >> a >> b;
    m[a]++;
    m[b]++;
    v[a].push_back(b);
  }
  set<int> second;
  for (auto x : m) {
    if (x.second < n - 1) {
      second.insert(x.first * -1);
    }
  }
  int cnt = 0;
  int arr[2];
  for (auto x : second) {
    if (cnt == 2) break;
    arr[cnt] = x * -1;
    cnt++;
  }
  if (v[arr[0]].size() > v[arr[1]].size()) {
    cout << arr[0] << " " << arr[1];
  } else
    cout << arr[1] << " " << arr[0];
  return 0;
}
