#include using namespace std; #if __has_include() #include using namespace atcoder; #endif using ll = long long; using ld = long double; using ull = unsigned long long; #define endl "\n" typedef pair Pii; #define REP(i, n) for (int i = 0; i < (n); ++i) #define REP3(i, m, n) for (int i = (m); (i) < int(n); ++ (i)) #define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++) #define rep(i,a,b) for(int i=(int)(a);i<(int)(b);i++) #define ALL(x) begin(x), end(x) #define PB push_back #define rrep(i,a,b) for(int i=a;i>=b;i--) #define fore(i,a) for(auto &i:a) #define all(s) (s).begin(),(s).end() #define drep2(i, m, n) for (int i = (m)-1; i >= (n); --i) #define drep(i, n) drep2(i, n, 0) #define rever(vec) reverse(vec.begin(), vec.end()) #define sor(vec) sort(vec.begin(), vec.end()) #define fi first #define se second #define pb push_back #define P pair #define PQminll priority_queue, greater> #define PQmaxll priority_queue,less> #define PQminP priority_queue, greater

> #define PQmaxP priority_queue,less

> #define NP next_permutation //typedef string::const_iterator State; //class ParseError {}; //const ll mod = 1000000009; const ll mod = 998244353; //const ll mod = 1000000007; const ll inf = 4100000000000000000ll; const ld eps = ld(0.000000000001); const long double pi = 3.141592653589793; templatevoid vcin(vector &n){for(int i=0;i>n[i];} templatevoid vcin(vector &n,vector &m){for(int i=0;i>n[i]>>m[i];} templatevoid vcout(vector &n){for(int i=0;ivoid vcin(vector> &n){for(int i=0;i>n[i][j];}}} templatevoid vcout(vector> &n){for(int i=0;ivoid print(T a){cout<void print(pair a){cout<bool chmax(T &a, const T &b) { if (abool chmin(T &a, const T &b) { if (b void ifmin(T t,T u){if(t>u){cout<<-1< void ifmax(T t,T u){if(t>u){cout<<-1<>=1;v>>=1;}else if(eu&&!ev){u>>=1;}else if(!eu&&ev){v>>=1;}else if(u>=v){u=(u-v)>>1;}else{ll tmp=u;u=(v-u)>>1;v=tmp;}}return !u?v<>= 1; } return ret; } vector divisor(ll x){ vector ans; for(ll i = 1; i * i <= x; i++){ if(x % i == 0) {ans.push_back(i); if(i*i!=x){ ans.push_back(x / ans[i]);}}}sor(ans); return ans; } ll pop(ll x){return __builtin_popcountll(x);} ll poplong(ll x){ll y=-1;while(x){x/=2;y++;}return y;} void cincout() { ios::sync_with_stdio(false); std::cin.tie(nullptr); cout<< fixed << setprecision(10); } ll m; vector nand(vector &a,vector &b){ vector ret(m); for(int i=0;i,vector> bunkai(vector &a){ vector x(m),y(m); ll c=0; for(int i=1;i &a){ ll c=0; for(int i=1;i>n>>m; string x; cin>>x; //1000 以降で作るとする vector> v(10000); cout<<2<<" "<<1000<<" "<<999999990<<" "<<999999990< u(m,1); v[1000]=u; //{1,1,1,1,...} for(int i=1;i z(m,0); for(int i=1;i> g(10000); ll now=3000; vector y(m); for(int i=0;i=3){ auto f=bunkai(v[0]); v[now]=f.fi; v[now+1]=f.se; g[0].pb(now); g[0].pb(now+1); now+=2; } for(int i=3000;i<10000;i++){ if(v[i].size()&&diff(v[i])>=3){ auto f=bunkai(v[i]); v[now]=f.fi; v[now+1]=f.se; g[i].pb(now); g[i].pb(now+1); now+=2; } } for(int i=0;i<10000;i++){ if(1<=i&&i<=2999) continue; if(v[i].size()&&g[i].size()==0){ if(diff(v[i])==0){ if(v[i][0]==1){ copy(1000,i); v[i]=v[1000]; } continue; } if(diff(v[i])==1){ ll now=1; for(int j=1;j=0;j--){ if(v[i][j+1]!=v[i][j]) break; now2++; } copy(2000+(m-(now+now2)),i); for(int j=0;j=0;i--){ if(g[i].size()){ cout<<2<<" "<