#include <bits/stdc++.h>
using namespace std;
int main () {
    int test; cin >> test; while (test--) {
        int r, t, n; cin >> r >> t >> n;
        int ans = 0;
        for (int i = 1; i <= r; ++i)
            for (int j = 1; j <= t; ++j) {
                int rr = r - i;
                int tt = t - j;
                if (tt >= rr and tt <= n * rr) ++ans, cout << "(" << rr << ", " << tt << "), ";
            }
        cout << endl; cout << ans << endl;
    }
    return 0;
}

