#include using namespace std; template void fin(T a){ cout<>m>>n; while(n--){ int a,b;cin>>a>>b; if(a==m||b==m)m=a+b-m; } cout<