#include "testlib.h"
#include<bits/stdc++.h>
 
using namespace std;

double factor = 1;

bool check(int x, int y) {
  assert(x != 0 && y != 0);
  factor = max({factor, x * 1.0 / y, y * 1.0 / x});
  if (3 * x < 2 * y) return false;
  if (3 * y < 2 * x) return false;
  return true;
}

int32_t main(int argc, char* argv[]) {
    registerTestlibCmd(argc, argv);
    int testCases = inf.readInt();
 
    for (int t = 0; t < testCases; ++t) {
        setTestCase(t + 1);
        int n = inf.readInt();
        int q = inf.readInt();
        for (int i = 0; i < n + 2 * q; ++i) inf.readInt();
        for (int i = 0; i < q; ++i) {
            int ja = ans.readInt(1, 2 * n), pa = ouf.readInt(1, 2 * n, "ans_" + to_string(i + 1));
            bool ok = check(pa, ja);
            if (!ok) quitf(_wa, "the answers %d and %d differ by more than 1.5x", pa, ja);
        }
    }
    quitf(_ok, "%d test cases(s). Max factor was %f", testCases, factor);
}
