#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1.0);
const int maxn = 100;
vector<int> adj[maxn];
bool marked[maxn];
void dfs(int s) {
  marked[s] = true;
  for (int i = 0; i < adj[s].size(); i += 1) {
    int y = adj[s][i];
    if (!marked[y]) dfs(y);
  }
}
int main() {
  int n;
  cin >> n;
  int play[n + 1], win[2];
  for (int i = 0; i < n + 1; i += 1) play[i] = 0;
  int l = n * (n - 1) / 2 - 1;
  while (l--) {
    int a, b;
    cin >> a >> b;
    adj[a].push_back(b);
    play[a]++;
    play[b]++;
  }
  int index = 0;
  for (int i = 0; i < n + 1; i += 1) {
    if (play[i] == n - 2) {
      win[index] = i;
      index++;
    }
  }
  dfs(win[0]);
  if (marked[win[1]])
    cout << win[0] << " " << win[1] << endl;
  else
    cout << win[1] << " " << win[0] << endl;
  return 0;
}
