#include <bits/stdc++.h>
using namespace std;
int n;
void solve() {
  cin >> n;
  vector<int> v(n + 1, 0);
  vector<int> t(n + 1, 0);
  for (int i = 0; i < n * (n - 1) / 2 - 1; i++) {
    int a, b;
    cin >> a >> b;
    v[a]++;
    t[a]++;
    t[b]++;
  }
  vector<int> k;
  for (int i = 1; i <= n; i++)
    if (t[i] == n - 2) k.push_back(i);
  if (v[k[0]] > v[k[1]])
    printf("%d %d\n", k[0], k[1]);
  else
    printf("%d %d\n", k[1], k[0]);
}
int main() {
  solve();
  return 0;
}
