#include using ll = long long; using namespace std; array b[1100][25]; 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[y + 60][x] = { h, p }; } y++; char c = 'S'; if (b[y + 1][x][0] > l / 100) { c = 'R'; if (b[y + 1][(x + 1) % 25][0] > l / 100) c = 'L'; } cout << c << endl; x += (c == 'R') - (c == 'L'); x = (x + 25) % 25; for (int i = 1; i < 60; i++) { if (auto &h = b[y + i][x][0]; h > 0) { h -= l / 100; if (h <= 0) { h = 0; l += b[y + i][x][1]; } cout << "#" << l << ' ' << h << '\n'; break; } } } return 0; }