package main
import (
"bufio"
"fmt"
"os"
)
func hasPath(adj [][]int, src, dst int) bool {
n := len(adj)
vis := make([]bool, n)
stack := []int{src}
vis[src] = true
for len(stack) > 0 {
v := stack[len(stack)-1]
stack = stack[:len(stack)-1]
if v == dst {
return true
}
for _, u := range adj[v] {
if !vis[u] {
vis[u] = true
stack = append(stack, u)
}
}
}
return false
}
func main() {
in := bufio.NewReader(os.Stdin)
out := bufio.NewWriter(os.Stdout)
defer out.Flush()
var n int
if _, err := fmt.Fscan(in, &n); err != nil {
return
}
m := n*(n-1)/2 - 1
seen := make([][]bool, n)
for i := range seen {
seen[i] = make([]bool, n)
}
adj := make([][]int, n)
for i := 0; i < m; i++ {
var x, y int
fmt.Fscan(in, &x, &y)
x--
y--
seen[x][y] = true
seen[y][x] = true
adj[x] = append(adj[x], y)
}
a, b := -1, -1
found:
for i := 0; i < n; i++ {
for j := i + 1; j < n; j++ {
if !seen[i][j] {
a, b = i, j
break found
}
}
}
if hasPath(adj, a, b) {
fmt.Fprintf(out, "%d %d\n", a+1, b+1)
} else if hasPath(adj, b, a) {
fmt.Fprintf(out, "%d %d\n", b+1, a+1)
} else {
fmt.Fprintf(out, "%d %d\n", a+1, b+1)
}
}