//An Emperor Production //in Association with Assistant Professor MR Ram Kripal Mishra. //Copyright (C) 2016,2015 CodeGeeks, Inc., //B-217 KIT, Rooma, Kanpur, INDIA //Everyone is permitted to copy and distribute verbatim copies //of this code, but changing it is not allowed. :P #include using namespace std; #define ln pf("\n") #define I inr() #define C inc() #define S ins() #define sp pf(" ") #define loop(i,a,b) for(int i=a;i=b;i--) #define pb push_back #define mp make_pair #define um unordered_map #define ppb pop_back() #define pf printf #define pi pair #define sf scanf #define swi switch #define vec vector #define veci vector #define vecs vector typedef long long ll; ll MOD = 1000000007; typedef unsigned long long ull; typedef string str; void ins(string &s){getline(cin,s);} int to_num(string s){return atoi(s.c_str());} ll power(ll x, ll y){ll temp;if( y == 0)return 1;temp = power(x, y/2)%MOD;if (y%2 == 0)return (temp*temp)%MOD;else{if(y > 0)return (x*temp*temp)%MOD;else return (temp*temp)/x;}} void to_binary(ll n){if(n==1){cout<<1; return;}to_binary(n>>1);cout<>V;return V;} str ins(){str s;cin>>s;return s;} char inc(){char c;cin>>c;return c;} int ans=1e9; int n,m; pair p[250][250]; queue > Q; int find_path() { Q.push(make_pair(0,0)); int mat[251][251]; loop(i,0,n) loop(j,0,m) mat[i][j]=1e9; mat[0][0]=0; pair K; while(!Q.empty()) { K=Q.front(); Q.pop(); int a=K.first,b=K.second; int f=p[a][b].first,l=p[a][b].second; loop(i,1,f+1) { if(mat[a+i][b]>mat[a][b]+1) { mat[a+i][b]=mat[a][b]+1; Q.push(make_pair(a+i,b)); } } loop(i,1,l+1) { if(mat[a][b+i]>mat[a][b]+1) { mat[a][b+i]=mat[a][b]+1; Q.push(make_pair(a,b+i)); } } } return mat[m-1][n-1]; } int main() { n=I; while(n--) cout<<"-1\n"; return 0; }