#include #include #include #include using namespace std; int n,m; typedef map > M; int q[202020]; int qu[202020]; int main() { while(scanf("%d %d", &n, &m), n!=0 && m!=0) { M inq; memset(q, 0, sizeof(int) * (m+10)); int maxqu=0; bool ok=true; for(int i=0; i())); inq[a].push_back(j); qu[maxqu++]=j; break; } } if(j==m) { ok=false; break; } } if(!ok) { puts("Transportation failed"); } else { printf("%d", qu[0]+1); for(int i=1; i &t=i->second; for(vector::iterator j=t.begin(); j!=t.end(); ++j) { printf("%s%d", first?"":" ", *j+1); first=false; } } puts(""); } } return 0; }