#include <bits/stdc++.h>

const int N = 305;
const int M = 2e6 + 5;
const int K = 605;
using std::vector;

int T, n, m, k;
int a[M];

namespace sub1 {
  vector<int> st[K];
  int bt[K];
  void solve() {
    for (int i = 1; i <= n; i++)
      st[i].clear(), bt[i] = 0;
    
    for (int i = 1; i <= m; i++) {
      int pos = (a[i] + 1) / 2;
      if (bt[pos] == (int)st[pos].size() || st[pos][bt[pos]] != a[i]) {
        printf("1 %d\n", pos);
        if (bt[pos] != (int)st[pos].size() && st[pos].back() == a[i])
          st[pos].pop_back();
        else st[pos].push_back(a[i]);
      } else {
        printf("1 %d\n", n);
        printf("2 %d %d\n", pos, n);
        bt[pos]++;
      }
    }
  }
}

signed main() {
  freopen("meow.in", "r", stdin);
  freopen("meow.out", "w", stdout);

  scanf("%d", &T);
  while (T--) {
    scanf("%d%d%d", &n, &m, &k);
    for (int i = 1; i <= m; i++)
      scanf("%d", a + i);
    
    if (k == 2 * n - 2) {
      sub1::solve();
    }
  }
}