#include using namespace std; int main(){ int n,m; cin>>n>>m; for(int i=0;i>p>>q; if(n==p)n=q; else if(n==q)n=p; else continue; } cout<