#include <iostream>
#include <vector>
using namespace std;

#define MAXL 5
#define MAXC 4
#define BackColor 2
int main() {
	int image1[MAXL][MAXC]=
	{
	  	{2,3,2,2},
	  	{2,2,2,2},
	  	{2,255,2,2},
	  	{255,2,2,2},
	  	{2,255,2,2}
	};

	std::vector<int> result;
	for (int i = 0; i<MAXL;i++)
	{
		for (int j=0; j<MAXC;j++)
		{
			if (image1[i][j] != BackColor)  // Notice !=
			{
				result.push_back(i+1);
				result.push_back(j+1);
				result.push_back(image1[i][j]);
			}
		}
	}


	for (auto x : result)
	{
		std::cout << x << " ";
	}
	std::cout << endl;
	return 0;
}