1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.StringTokenizer;
import java.lang.StringBuilder;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Random;
import java.util.HashSet;
import java.util.HashMap;

public class cie{
  /*reader template*/
  static class InputReader {
    public BufferedReader reader;
    public StringTokenizer tokenizer;

    public InputReader(InputStream stream) {
      reader = new BufferedReader(new InputStreamReader(stream), 32768);
      tokenizer = null;
    }

    public String next() {
      while (tokenizer == null || !tokenizer.hasMoreTokens()) {
        try {
          tokenizer = new StringTokenizer(reader.readLine(), " \t\n\r\f/");
        } catch (IOException e) {
          throw new RuntimeException(e);
        }
      }
      return tokenizer.nextToken();
    }
    
    public int nextInt() {
      return Integer.parseInt(next());
    }
    
  }
  
  static class Oracle{
    int d;
    int r;
    int coords[];
    int lastResult = -1;
    int queryCount = 0;

 
    
    public int query(int[] q, PrintWriter pw){
//       queryCount++;
// //       printArray(d,q,pw);
//       int max = -1;
//       for(int i=0;i<d;++i){
//         if(q[i] < 0 || q[i] > 100000){
//           System.out.println("buM");
//         }
//         max = Math.max(Math.abs(coords[i] - q[i]), max);
//       }
//       
//       if(lastResult == -1){
//         lastResult = max;
//         return 0;
//       } else {
//         if (max < lastResult){
//           lastResult = max;
// //           pw.println("result 1, max " + max);
//           return 1;
//         }
//         
//         lastResult = max;
// //         pw.println("result 0, max " + max);
//         return 0;
//       }
      return cielib.czyCieplo(q);
    }
    
    public void printPoint(PrintWriter pw){
      printArray(d, coords, pw);
    }
    public void accept(int[] arr){
//       boolean good = true;
//       for(int i=0;i<d;++i){
//         good &= (arr[i] == coords[i]);
//       }
//       return good;
      cielib.znalazlem(arr);
    }
    
  }
  
  public static void printArray(int d, int[] arr, PrintWriter pw){
    pw.print("(");
    for(int i=0;i<d-1;++i){
      pw.print(""+arr[i]+",");
    }
    pw.println(""+arr[d-1]+")");
  }
  
  private static boolean check(int d, int[] q, int r, Oracle oracle, PrintWriter pw){
    int count = 0;
    for(int i=0;i<d;++i){
      int ans1 = 0;
      if(q[i]!= r){
        q[i]++;
        oracle.query(q,pw);
        q[i]--;
        ans1= oracle.query(q,pw);
      } else {
        ans1=1;
      }
      int ans2 = 0;
      if(q[i]!= 0){
        q[i]--;
        oracle.query(q,pw);
        q[i]++;
        ans2 = oracle.query(q,pw);
      } else {
        ans2 = 1;
      }
      if(ans1 == 1 && ans2 == 1){
        count ++;
      }
    }
    if(count == d){
//       pw.println("found!");
//       printArray(d,q,pw);
//       pw.println("with " + oracle.queryCount + " queries");
//       pw.println("accepted " + oracle.accept(q));
      oracle.accept(q);
      return true;
    }
    return false;
  }
  
  public static void solve(int d, int r){
    PrintWriter pw = new PrintWriter(System.out);
    Oracle oracle = new Oracle();
//     oracle.printPoint(pw);
    /*read from lib*/
    
    
    
    
    
    int[] q = new int[d];
    int[] upBorder = new int[d];
    int[] lowBorder = new int[d];
    int set = 0;
    for(int i=0; i<d;++i){
      q[i] = r/2+1;
      upBorder[i] = r;
      lowBorder[i] = 0;
    }
        
    oracle.query(q,pw);
    HashMap<Integer, HashSet<Integer>> cache = new HashMap<Integer, HashSet<Integer>>();
    for(int i=0;i<d;++i){
      HashSet<Integer> empty = new HashSet<Integer>();
      empty.add(i);
      cache.put(i,empty);
    }
    
    while(true){
      //try find max going up
      boolean goUp = false;
      boolean foundDown = false;
//       pw.println("check up");
      HashSet<Integer> repPositionsUp = null;
      HashSet<Integer> visited = new HashSet<Integer>();
      HashSet<HashSet<Integer> >  cnt = new HashSet<HashSet<Integer> >();
      cnt.addAll(cache.values());
      if(cnt.size() > 2){
      
  //       pw.println(cache);
        int tmp[] = new int[d];
        for(int i=0;i<d;++i){
          tmp[i] = Math.min(q[i]+1, r);
        }
        oracle.query(tmp,pw);
        goUp = (oracle.query(q,pw)==1);
      } else {
        goUp = true;
      }
      if(goUp){
        int rep = -1;
        for(int i=0;i<d;++i){
          if(rep>=0 && cache.get(rep).contains(i)){
            continue;
          }
          if(visited.contains(i)){
            continue;
          } else {
            visited.addAll(cache.get(i));
          }
          if(q[i] == r){
            continue;
          }
          q[i]++;
          oracle.query(q,pw);
          q[i]--;
          if(oracle.query(q,pw)==1){
            //first maximal
            if(rep == -1){
              rep = i;
              repPositionsUp = cache.get(rep);
            } else {
              HashSet<Integer> positionsUp = cache.get(i);
              repPositionsUp.addAll(positionsUp);
              for(int j : positionsUp){
                cache.put(i, repPositionsUp);
              }
            }
          }
        }
        if(rep>=0){
          //make intervals of equal size
          int bUp = Integer.MAX_VALUE;
          int bDown = Integer.MAX_VALUE;
          for(int p : repPositionsUp){
            bUp = Math.min(bUp, upBorder[p] - q[p]);
            bDown = Math.min(bDown,  q[p] - lowBorder[p]);
          }
          
          for(int p : repPositionsUp){
            upBorder[p] = q[p] + bUp;
            lowBorder[p] = q[p] - bDown;
          }
        
          for(int p : repPositionsUp){
            upBorder[p] = q[p];
            q[p] = (lowBorder[p] + q[p])/2;
          }
        }
        boolean good = true;
        for(int i=0;i<d;++i){
          good&=(upBorder[i]-lowBorder[i] <= 1);
        }
        if(good && check(d,q,r,oracle, pw)){
          break;
        }
      }
      
      
      boolean goDown = true;
      if(cnt.size() > 2){
        goDown = true;
      } else {
        int[] tmp = new int[d];
        for(int i=0;i<d;++i){
          tmp[i] = Math.max(q[i]-1, 0);
        }
        oracle.query(tmp,pw);
        goDown = (oracle.query(q,pw)==1);
      }
      
      if(goDown){
        int rep = -1;
        HashSet<Integer> repPositionsDown = new HashSet<Integer>();
        rep = -1;
        visited = new HashSet<Integer>();
  //       pw.println("check down");  
        for(int i=0;i<d;++i){
          if(rep>=0 && cache.get(rep).contains(i)){
            continue;
          }
          if(visited.contains(i)){
            continue;
          } else {
            visited.addAll(cache.get(i));
          }
          if(q[i] == 0){
            continue;
          }
          
          q[i]--;
          oracle.query(q,pw);
          q[i]++;
          if(oracle.query(q,pw) == 1){
            //first maximal
            if(rep == -1){
              rep = i;
              repPositionsDown = cache.get(rep);
              //first in this class of abstraction
            } else {
              HashSet<Integer> positionsDown = cache.get(i);
              repPositionsDown.addAll(positionsDown);
              for(int j : positionsDown){
                cache.put(i, repPositionsDown);
              }
            }
          }
        }
        if(rep>=0){
          int bUp = Integer.MAX_VALUE;
          int bDown = Integer.MAX_VALUE;
          for(int p : repPositionsDown){
            bUp = Math.min(bUp, upBorder[p] - q[p]);
            bDown = Math.min(bDown,  q[p] - lowBorder[p]);
          }
          
          for(int p : repPositionsDown){
            upBorder[p] = q[p] + bUp;
            lowBorder[p] = q[p] - bDown;
          }
          
          for(int p : repPositionsDown){
            lowBorder[p] = q[p];
            q[p] = (upBorder[p] + q[p]+1)/2;
          }
          oracle.query(q,pw);
        }
        boolean good = true;
        for(int i=0;i<d;++i){
          good&=(upBorder[i]-lowBorder[i] <= 1);
        }
        if(good && check(d,q,r,oracle, pw)){
          break;
        }
      }
      
      
      
//        printArray(d, upBorder, pw);
//        printArray(d, q, pw);
//        printArray(d, lowBorder, pw);
    
    
    }
    pw.flush();
    pw.close();
  }
  

  public static void main(String args[]){
    InputReader reader = new InputReader(System.in);
    PrintWriter pw = new PrintWriter(System.out);
//     int d = reader.nextInt();
//     int r = reader.nextInt();
    int d = cielib.podajD();
    int r = cielib.podajR();
    solve(d, r);
  }

}