package main import ( "fmt" ) func main() { var mark [4]bool var N, M int fmt.Scan(&N, &M) mark[N] = true var P, Q int for i := 0; i < M; i++ { fmt.Scan(&P, &Q) mark[P], mark[Q] = mark[Q], mark[P] } for i, v := range mark { if v { fmt.Println(i) } } }