#include<iostream>
#include<vector>
#include<string>
#include<utility>
#include<algorithm>
#include<bitset>
#define rep(a) for(int i = 0; i < a; i++)
using namespace std;

struct LB {
	int NumofSw;
	int sw = 0;
	bool isOnwhenOdd = 0;
};

int bitcount(int bits) {
		bits = (bits & 0x5555) + (bits >> 1 & 0x5555);
		bits = (bits & 0x3333) + (bits >> 2 & 0x3333);
		bits = (bits & 0x0f0f) + (bits >> 4 & 0x0f0f);
		bits = (bits & 0x00ff) + (bits >> 8 & 0x00ff);
		return bits;
}


int main()
{
	int N, M;
	cin >> N >> M;
	//N sw
	//M lamp

	vector<LB> LBs(M);

	int temp;
	rep(M)
	{