#include <bits/stdc++.h>
using namespace std;
int a[1010][1010], cnt[1010];
bool v[1010][1010];
vector<int> G[1010];
bool Exists(int x, int y) {
  for (int i = 0; i < G[x].size(); i++)
    if (G[x][i] == y) return true;
  return false;
}
bool isValid(int x, int y) {
  int len = G[y].size();
  for (int i = 0; i < len; i++) {
    int cur = G[y][i];
    if (!Exists(x, cur)) return false;
  }
  return true;
}
int main() {
  memset(cnt, 0, sizeof(cnt));
  memset(G, 0, sizeof(G));
  int n;
  scanf("%d", &n);
  for (int i = 1; i < (n * (n - 1)) / 2; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    cnt[x]++;
    cnt[y]++;
    G[x].push_back(y);
  }
  int x, y;
  for (int i = 1; i <= n; i++) {
    if (cnt[i] != n - 1) {
      x = i;
      cnt[i]++;
      break;
    }
  }
  for (int i = 1; i <= n; i++) {
    if (cnt[i] != n - 1) {
      y = i;
      cnt[i]++;
      break;
    }
  }
  if (isValid(x, y))
    printf("%d %d\n", x, y);
  else
    printf("%d %d\n", y, x);
  return 0;
}
