#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <sys/time.h>
#include <assert.h>

#define WIDTH 356
#define HEIGHT 292
#define BUFLEN 256
#define PTX 220
#define PTY 206
#define RFX 280
#define RFY 183

int main(int argc, char *argv[]) {
	unsigned char buf[WIDTH*HEIGHT*3];
	int ret;
	unsigned long cnt = 0;

	for(;;) {
	    int sample, sample2;

	    fgets(buf, BUFLEN, stdin);
	    assert(buf[0] == 'P' && buf[1] == '6');
	    fgets(buf, BUFLEN, stdin);
	    fgets(buf, BUFLEN, stdin);
	    ret = fread(buf, WIDTH*HEIGHT*3, 1, stdin);
	    assert(ret == 1);

	    sample = buf[PTX*3+PTY*WIDTH*3+1/*green*/];
	    sample2 = buf[RFX*3+RFY*WIDTH*3+1/*green*/];
	    printf("%ld %d %d\n", cnt, sample, sample2);
	    
	    cnt++;
	}
	return 0;
}
	
