#include #include #include #include using namespace std; #define maxn 111111 int h[maxn],q[maxn]; map ma; vector ve[maxn]; int num[maxn]; int Scan() { int res = 0, ch, flag = 0; if((ch = getchar()) == '-') //判断正负 flag = 1; else if(ch >= '0' && ch <= '9') //得到完整的数 res = ch - '0'; while((ch = getchar()) >= '0' && ch <= '9' ) res = res * 10 + ch - '0'; return flag ? -res : res; } int main() { int n, m; while(scanf("%d %d",&n,&m)!=EOF) { memset(num,0,sizeof(num)); ma.clear(); int i; int flag = 1; for(i=0;ive[ma[x]].size()-1) { printf("-1\n"); } else { // printf("%d\n",ma[x]); printf("%d\n",ve[ma[x]][num[ma[x]]]); num[ma[x]]++; } } } } return 0; }