#include <stdio.h>
#include <iostream>

using namespace std;

int main() {
	long int t = 0;
	long int new_t = 0;
	float v;
	do {
		cin >> new_t >> v;
		if (cin.fail()) {
			return 0;
		}
		if (t && new_t - t > 3600) {
			for (int i = t; i < new_t; i += 600) {
				cout << i << " NaN" << endl;
			}
		}
		t = new_t;
		cout << t << " " << v << endl;
	} while (1);
	return 0;
}
