#include <bits/stdc++.h>
using namespace std;
bool b[52][52], p, reached[52];
int num, num1;
vector<vector<int>> v;
void dfs(int n) {
  reached[n] = true;
  if (n == num1) {
    p = true;
    return;
  }
  for (int i = 0; i < v[n].size() && !p; ++i)
    if (!reached[v[n][i]]) dfs(v[n][i]);
}
int main() {
  int n, x, y;
  cin >> n;
  for (int i = 0; i < n; ++i) v.push_back({});
  for (int i = 0; i < ((n * (n - 1)) / 2) - 1; ++i) {
    cin >> x >> y;
    --x;
    --y;
    b[x][y] = b[y][x] = true;
    v[x].push_back(y);
  }
  for (int i = 0; i < n - 1; ++i)
    for (int j = i + 1; j < n; ++j)
      if (!b[i][j]) {
        num = i;
        num1 = j;
        i = j = n;
      }
  dfs(num);
  if (p)
    cout << num + 1 << " " << num1 + 1 << '\n';
  else
    cout << num1 + 1 << " " << num + 1 << '\n';
}
