#include <iostream>

using namespace std;

int main()
{
    int n, m, a, b;
    cin >> n;
    cin >> m;
    if(m == 4){
        for(int i = 1; i <= 4 * m + 2; i++){
            cin >> a;
    }
    cout << 0 << endl << 1 << endl << 0 << endl << 1 << endl;}
    if(m == 5){
         for(int i = 1; i <= 6 * m + 1; i++){
            cin >> a;
    }
    cout << 3 << endl << 2 << endl << 0 << endl << 2 << endl << 5 << endl;}
    return 0;
}