#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
vector<vector<int> > g;
vector<char> used;
void dfs(int v) {
  used[v] = true;
  for (int to : g[v])
    if (!used[to]) dfs(to);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  g.resize(n);
  vector<vector<char> > p(n, vector<char>(n, false));
  for (int i = 0; i < n * (n - 1) / 2 - 1; ++i) {
    int u, v;
    cin >> u >> v;
    --u, --v;
    g[u].push_back(v);
    p[u][v] = p[v][u] = true;
  }
  int x, y;
  for (int i = 0; i < n; ++i)
    for (int j = i + 1; j < n; ++j)
      if (!p[i][j]) x = i, y = j;
  used.assign(n, false);
  dfs(x);
  if (used[y])
    cout << x + 1 << " " << y + 1 << endl;
  else
    cout << y + 1 << " " << x + 1 << endl;
}
