#include <bits/stdc++.h>
using namespace std;
const long long MAXN = 1e+2 + 7;
const long long MOD = 1e+9 + 7, MOD1 = 998244353, INF = 0x7f7f7f7f7f7f7f7f;
const int INFi = 0x7f7f7f7f;
double EPS = 1e-9;
double PI = acos(-1);
vector<vector<long long> > transpose(const vector<vector<long long> > &m) {
  vector<vector<long long> > result(m.size(),
                                    vector<long long>(m[0].size(), 0));
  for (vector<long long>::size_type i(0); i < m.size(); ++i)
    for (vector<long long>::size_type j(0); j < m[0].size(); ++j)
      result[i][j] = m[j][i];
  return result;
}
long long n, x = 0, y = 0, a, b;
vector<vector<long long> > adj, pairs;
vector<long long> vis(51, 0);
void dfs(long long x) {
  if (vis[x]) return;
  vis[x] = 1;
  for (auto i : adj[x]) dfs(i);
}
int main() {
  ios::sync_with_stdio(false);
  cout << fixed;
  cout.tie(nullptr);
  cin.tie(nullptr);
  cout << setprecision(0);
  ;
  cin >> n;
  adj.resize(n + 1);
  pairs.resize(n + 1);
  for (long long i = 0; i < (n * (n - 1)) / 2 - 1; i += 1) {
    cin >> a >> b;
    adj[a].push_back(b);
    if (a > b) {
      a += b;
      b = a - b;
      a -= b;
    }
    pairs[a].push_back(b);
  }
  for (long long i = 1; i < n + 1; i += 1) {
    if (pairs[i].size() + i != n) {
      sort(pairs[i].begin(), pairs[i].end());
      x = i;
      for (long long j = i + 1, k = 0; k < pairs[i].size(); j++, k++) {
        if (pairs[i][k] != j) {
          y = j;
          break;
        }
      }
      if (!y) y = n;
      if (x) break;
    }
  }
  dfs(x);
  if (vis[y])
    cout << x << " " << y;
  else
    cout << y << " " << x;
}
