#include using ll = long long; using namespace std; array b[25][1100]; int main() { int x = 12, y = 0, l = 100; for (int turn = 0; turn < 1000; turn++) { int n; cin >> n; if (n < 0) exit(0); for (int i = 0; i < n; i++) { int h, p, x; cin >> h >> p >> x; b[x][y + 60] = { h, p }; } y++; int m = l / 100; char c = 'S'; int r[25]; for (int i = 0; i < 25; i++) { int s = 100; int d = abs(x - i); d = min(d, 25 - d); d = max(d - 1, 0); for (int j = 1 + d; j < 60; j++) { if (auto h = b[i][y + j][0]; h > 0) { int t = (h + m - 1) / m + d; if (t > j) s = 200; else s = t; break; } } r[i] = s; } int t[2] = {}; for (int i = 1; i <= 12; i++) { t[0] |= b[(x + i + 25) % 25][y - 1 + i][0]; t[1] |= b[(x - i + 25) % 25][y + 1 - i][0]; if (t[0]) r[(x + i + 25) % 25] = 300; if (t[1]) r[(x - i + 25) % 25] = 300; } if (int i = min_element(r, r + 25) - r; i != x) c = "LR"[i - x > 0 ^ abs(i - x) > 12]; cout << '#'; for (int i = 0; i < 25; i++) { cout << r[i] << " \n"[i == 24]; } cout << c << endl; x += (c == 'R') - (c == 'L'); x = (x + 25) % 25; for (int j = 1; j < 60; j++) { if (auto &h = b[x][y + j][0]; h > 0) { h -= m; if (h <= 0) { h = 0; l += b[x][y + j][1]; } cout << "#" << l << ' ' << h << '\n'; break; } } } return 0; }