#include <bits/stdc++.h>
using namespace std;
vector<long long int> adj[100];
long long int num1 = 0, num2 = 0;
bool vis[101];
bool dfs(long long int i) {
  stack<long long int> s;
  s.push(i);
  vis[i] = true;
  while (!s.empty()) {
    long long int ele = s.top();
    s.pop();
    for (long long int j = 0; j < adj[ele].size(); j++) {
      if (adj[ele][j] == num2) return true;
      if (!vis[adj[ele][j]]) {
        vis[adj[ele][j]] = true;
        s.push(adj[ele][j]);
      }
    }
  }
  return false;
}
void solve() {
  long long int n;
  cin >> n;
  vector<long long int> num(n + 1, n - 1);
  for (long long int i = 01; i < (n * (n - 1)) / 2; i++) {
    long long int w, l;
    cin >> w >> l;
    adj[w].push_back(l);
    num[w]--;
    num[l]--;
  }
  for (long long int i = 1; i <= n; i++) {
    if (num[i] == 1) {
      if (!num1)
        num1 = i;
      else
        num2 = i;
    }
  }
  if (dfs(num1))
    cout << num1 << " " << num2;
  else
    cout << num2 << " " << num1;
}
int main() { solve(); }
