#include <iostream>
#include <string>

using namespace std;

// input data
int N, L;

int main() {
//  uncomment the following lines if you want to read/write from files
//  freopen("input.txt", "r", stdin);
//  freopen("output.txt", "w", stdout);

    cin >> N >> L;
    for (int i=0; i<N; ++i) {
        int M;
        cin >> M;
        for (int j=0; j<M; ++j) {
            string s;
            cin >> s;
            // insert code here
        }
    }

    cout << 4 << " " << 2 << endl; // print the result
    return 0;
}
