#include #include using namespace std; int pix[1000][1000]; main() { string s; cin >> s; if (s != "P2") { cerr << "Not a PGM\n"; return 1; } int xmax, ymax, zmax; cin >> xmax >> ymax >> zmax; if (xmax > 1000 || ymax > 1000) { cerr << "Please enlarge me\n"; return 1; } for (int j = ymax - 1; j >= 0; j--) for (int i = 0; i < xmax; i++) cin >> pix[i][j]; for (int i = 0; i < xmax; i++) { for (int j = 0; j < ymax; j++) cout << i << '\t' << j << '\t' << pix[i][j] << '\n'; cout << '\n'; } }