#include using namespace std; int F, K; string s[110]; int vx[4] = {0, 1, 0, -1}, vy[4] = {1, 0, -1, 0}; char dir[4] = {'L', 'U', 'R', 'D'}; int main() { ifstream in; ofstream out; in.open("catsdogs.in", ios::in); out.open("catsdogs.out", ios::out); in >> F >> K; int pasa = 0; for (int fronta = 0; fronta < F; fronta++) { int N, M, B; in >> N >> M >> B; for (int i = 0; i < N; i++) { in >> s[i]; } for (int i = 0; i < N; i++) { for (int j = 0; j < M; j++) { if (s[i][j] >= '1' && s[i][j] <= '9') { if (pasa >= K) continue; out << fronta + 1 << endl << i + 1 << " " << j + 1 << endl << "STAY" << endl; pasa++; } } } } while (pasa++ < K) out << 0 << endl; in.close(); out.close(); return 0; }