#include "testlib.h"
#include <bits/stdc++.h>

using namespace std;

const int MIN_N = 1;
const int MAX_N = 4096;

const int rnd_test_n = 100;

template <typename T> void append(vector<T> &dest, const vector<T> &orig) {
	dest.insert(dest.end(), orig.begin(), orig.end());
}

string output_tc(const vector<string> &positions) {
	ostringstream oss;
    oss << (int)positions.size() << endl;
    for (const string &pos : positions) {
        oss << pos << endl;
    }
	return oss.str();
}

vector<string> generate_sample_tests() {
	vector<string> tests;
    tests.push_back(output_tc({"a1 h8", "a1 c2", "h8 c3"}));
	return tests;
}

vector<string> generate_manual_tests() {
	vector<string> tests;
	tests.push_back(output_tc({"a1 a1"}));
	tests.push_back(output_tc({"b5 g3"}));
	return tests;
}

string rnd_test(int i){
    int cases = rnd.next(MIN_N, MAX_N);
    vector<string> positions;
    while (cases--) {
        string start = rnd.next("[a-h][1-8]");
        string end = rnd.next("[a-h][1-8]");
        positions.push_back(start + " " + end);
    }

    return output_tc(positions);
}

vector<string> generate_random_tests() { 
    vector<string> tests;
    for (int i = 0; i < rnd_test_n; i++){
        tests.push_back(rnd_test(i));
    } 
    return tests;
}

int main(int argc, char *argv[]) {
	registerGen(argc, argv, 1);
	vector<string> tests;
	size_t test = 0;
	append(tests, generate_sample_tests());
	append(tests, generate_manual_tests());
	append(tests, generate_random_tests());
	for (const auto &t : tests) {
		startTest(++test);
		cout << t;
	}
	return 0;
}