#include<iostream> #include<cmath> #include<set> #include<vector> #define maxn 1000005 using namespace std; struct Node{ int address,data,next; }node[maxn]; int main(){ int head,n,address,data,next; scanf("%d%d",&head,&n); for(int i=0;i<n;i++){ scanf(&...