#include <iostream>
#include <algorithm>
#include "legos.h"
using namespace std;

namespace grader_2885434567765456945845{
    const string PASSWORD = "32978942479237592564384318978573475";

    int gcd(int a, int b) {
        if (b == 0) return a;
        return gcd(b, a % b);
    }

    void output(double score, string message) {
        cout << PASSWORD << '\n';
        cout << score << '\n';
        cout << message << '\n';
    
        exit(0);
    }

    void myAssert(bool flag, string message) {
        if (flag) return;
        output(0, message);
    }
};


int main() {

    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    int t;
    cin >> t;

    while (t--) {
        int n;
        cin >> n;

        vector <int> v(n);

        int gcd = 0;

        for (int& x : v) {
            cin >> x;
            gcd = grader_2885434567765456945845::gcd(gcd, x);
        }

        auto [flag, moves] = solve(v);

        bool expected_flag = gcd == 1;

        grader_2885434567765456945845::myAssert(flag == expected_flag, "Wrong answer!");
        if (!flag) continue;

        reverse(moves.begin(), moves.end());

        for (auto [idx, cnt] : moves) {
            grader_2885434567765456945845::myAssert(0 <= idx && idx < n && cnt > 0, "Wrong answer!");
            long long val = v[idx];
            val -= (long long) v[(idx + 1) % n] * cnt;

            grader_2885434567765456945845::myAssert(val > 0, "Wrong answer!");
            v[idx] = val;
        }

        for (int x : v) {
            grader_2885434567765456945845::myAssert(x == 1, "Wrong answer!");
        }
    }
    
    grader_2885434567765456945845::output(1, "OK!");
    return 0;

}