description: <image>
  
  This is an interactive task
  
  William has a certain sequence of integers a_1, a_2, ..., a_n in his mind, but due to security concerns, he does not want to reveal it to you completely. William is ready to respond to no more than 2 ⋅ n of the following questions:
  
    * What is the result of a [bitwise AND](https://en.wikipedia.org/wiki/Bitwise_operation#AND) of two items with indices i and j (i ≠ j) 
    * What is the result of a [bitwise OR](https://en.wikipedia.org/wiki/Bitwise_operation#OR) of two items with indices i and j (i ≠ j) 
  
  
  
  You can ask William these questions and you need to find the k-th smallest number of the sequence.
  
  Formally the k-th smallest number is equal to the number at the k-th place in a 1-indexed array sorted in non-decreasing order. For example in array [5, 3, 3, 10, 1] 4th smallest number is equal to 5, and 2nd and 3rd are 3.
  
  Input
  
  It is guaranteed that for each element in a sequence the condition 0 ≤ a_i ≤ 10^9 is satisfied.
  
  Interaction
  
  In the first line you will be given two integers n and k (3 ≤ n ≤ 10^4, 1 ≤ k ≤ n), which are the number of items in the sequence a and the number k.
  
  After that, you can ask no more than 2 ⋅ n questions (not including the "finish" operation).
  
  Each line of your output may be of one of the following types: 
  
    * "or i j" (1 ≤ i, j ≤ n, i ≠ j), where i and j are indices of items for which you want to calculate the bitwise OR. 
    * "and i j" (1 ≤ i, j ≤ n, i ≠ j), where i and j are indices of items for which you want to calculate the bitwise AND. 
    * "finish res", where res is the kth smallest number in the sequence. After outputting this line the program execution must conclude. 
  
  
  
  In response to the first two types of queries, you will get an integer x, the result of the operation for the numbers you have selected.
  
  After outputting a line do not forget to output a new line character and flush the output buffer. Otherwise you will get the "Idleness limit exceeded". To flush the buffer use:
  
    * fflush(stdout) in C++ 
    * System.out.flush() in Java 
    * stdout.flush() in Python 
    * flush(output) in Pascal 
    * for other languages refer to documentation 
  
  
  
  If you perform an incorrect query the response will be -1. After receiving response -1 you must immediately halt your program in order to receive an "Incorrect answer" verdict.
  
  Hacking
  
  To perform a hack you will need to use the following format:
  
  The first line must contain two integers n and k (3 ≤ n ≤ 10^4, 1 ≤ k ≤ n), which are the number of items in the sequence a and the number k.
  
  The second line must contain n integers a_1, a_2, ..., a_n (0 ≤ a_i ≤ 10^9), the sequence a.
  
  Example
  
  Input
  
  
  7 6
  
  2
  
  7
  
  Output
  
  
  and 2 5
  
  or 5 6
  
  finish 5
  
  Note
  
  In the example, the hidden sequence is [1, 6, 4, 2, 3, 5, 4].
  
  Below is the interaction in the example.
  
  Query (contestant's program)| Response (interactor)| Notes  
  ---|---|---  
  and 2 5| 2| a_2=6, a_5=3. Interactor returns bitwise AND of the given numbers.  
  or 5 6| 7| a_5=3, a_6=5. Interactor returns bitwise OR of the given numbers.  
  finish 5| | 5 is the correct answer. Note that you must find the value and not the index of the kth smallest number.
solution: #include <bits/stdc++.h>
  using namespace std;
  long long int power(long long int a, long long int n) {
    if (n == 0)
      return 1;
    else if (n == 1)
      return a;
    else {
      if (n % 2 == 0)
        return (power(a, n / 2) % 1000000007 * power(a, n / 2) % 1000000007) %
               1000000007;
      else
        return (power(a, n / 2) % 1000000007 * power(a, n / 2) % 1000000007 * a) %
               1000000007;
    }
  }
  bool poweroftwo(int x) { return x && (!(x & (x - 1))); }
  long long int cmpi(pair<long long int, long long int> a,
                     pair<long long int, long long int> b) {
    return a.second > b.second;
  }
  long long int gcd(long long int a, long long int b) {
    if (b == 0) return a;
    return gcd(b, a % b);
  }
  long long int search(long long int a[], long long int n, long long int x) {
    long long int l = 0, r = n - 1;
    if (x < a[l] || x > a[r]) return -1;
    while (l <= r) {
      long long int mid = l + (r - l) / 2;
      if (a[mid] == x) return 1;
      if (a[mid] < x)
        l = mid + 1;
      else
        r = mid - 1;
    }
    return -1;
  }
  long long int isprime(long long int x) {
    if (x == 1) return 0;
    long long int flag = 0;
    for (long long int i = 2; i * i <= x; i++) {
      if (x % i == 0) {
        flag++;
        break;
      }
    }
    if (flag) return 0;
    return 1;
  }
  vector<long long int> a;
  long long int query(long long int x, long long int y) {
    long long int ans1, ans2, ans;
    cout << "or " << x << " " << y << endl;
    cin >> ans1;
    cout << "and " << x << " " << y << endl;
    cin >> ans2;
    return ans1 + ans2;
  }
  int main() {
    long long int n, k;
    cin >> n >> k;
    long long int a01 = query(1, 2);
    long long int a12 = query(2, 3);
    long long int a02 = query(1, 3);
    a.push_back(0);
    a.push_back(0);
    a.push_back(0);
    a[1] = ((a01 + a12 - a02) / 2);
    a[0] = a01 - a[1];
    a[2] = a12 - a[1];
    for (long long int i = 4; i < n + 1; i++) {
      long long int temp = query(2, i);
      a.push_back(temp - a[1]);
    }
    sort(a.begin(), a.end());
    cout << "finish ";
    cout << a[k - 1] << endl;
  }
  