#include <bits/stdc++.h>
int main() {
  int playerNum, index1, index2, winner, looser;
  std::cin >> playerNum;
  std::vector<int> winVect(playerNum);
  std::vector<int> looseVect(playerNum);
  std::vector<std::vector<int> > matches;
  for (index1 = 0; index1 < playerNum * (playerNum - 1) / 2 - 1; index1++) {
    std::cin >> winner >> looser;
    matches.push_back(std::vector<int>{winner, looser});
    winVect[winner - 1]++;
    looseVect[looser - 1]++;
  }
  std::vector<int> winnerPossible(2, playerNum + 1);
  std::vector<int> looserPossible(2, playerNum + 1);
  for (index1 = 0; index1 < playerNum - 1; index1++) {
    for (index2 = index1 + 1; index2 < playerNum; index2++)
      if (winVect[index1] == winVect[index2]) {
        winnerPossible[0] = index1 + 1;
        winnerPossible[1] = index2 + 1;
        break;
      }
    if (index2 < playerNum && winVect[index1] == winVect[index2]) break;
  }
  for (index1 = 0; index1 < playerNum - 1; index1++) {
    for (index2 = index1 + 1; index2 < playerNum; index2++) {
      if (looseVect[index1] == looseVect[index2]) {
        looserPossible[0] = index1 + 1;
        looserPossible[1] = index2 + 1;
        break;
      }
    }
    if (index2 < playerNum && looseVect[index1] == looseVect[index2]) {
      break;
    }
  }
  if (winnerPossible[0] != looserPossible[0]) {
    for (index1 = 0; index1 < playerNum * (playerNum - 1) / 2 - 1; index1++) {
      if (matches[index1][0] == winnerPossible[0] &&
          matches[index1][1] == looserPossible[0])
        break;
    }
    if (index1 == playerNum * (playerNum - 1) / 2 - 1) {
      std::cout << winnerPossible[0] << " " << looserPossible[0];
      return 0;
    }
  }
  if (winnerPossible[0] != looserPossible[1]) {
    for (index1 = 0; index1 < playerNum * (playerNum - 1) / 2 - 1; index1++) {
      if (matches[index1][0] == winnerPossible[0] &&
          matches[index1][1] == looserPossible[1])
        break;
    }
    if (index1 == playerNum * (playerNum - 1) / 2 - 1) {
      std::cout << winnerPossible[0] << " " << looserPossible[1];
      return 0;
    }
  }
  if (winnerPossible[1] != looserPossible[0]) {
    for (index1 = 0; index1 < playerNum * (playerNum - 1) / 2 - 1; index1++) {
      if (matches[index1][0] == winnerPossible[1] &&
          matches[index1][1] == looserPossible[0])
        break;
    }
    if (index1 == playerNum * (playerNum - 1) / 2 - 1) {
      std::cout << winnerPossible[1] << " " << looserPossible[0];
      return 0;
    }
  }
  if (winnerPossible[1] != looserPossible[1]) {
    for (index1 = 0; index1 < playerNum * (playerNum - 1) / 2 - 1; index1++) {
      if (matches[index1][0] == winnerPossible[1] &&
          matches[index1][1] == looserPossible[1])
        break;
    }
    if (index1 == playerNum * (playerNum - 1) / 2 - 1) {
      std::cout << winnerPossible[1] << " " << looserPossible[1];
      return 0;
    }
  }
  return 0;
}
