# import pypyjit;pypyjit.set_param("max_unroll_recursion=-1") # from bisect import * # from collections import * # from heapq import * # from itertools import * # from math import * # from datetime import * # from decimal import * # PyPyだと遅い # from string import ascii_lowercase, ascii_uppercase # import numpy as np import sys import os # sys.setrecursionlimit(10**6) # PyPyだと遅い INF = 10**18 MOD = 998244353 # MOD = 10**9 + 7 isTest = os.path.exists("input.txt") File = open("input.txt", "r") if isTest else sys.stdin def input(): return File.readline()[:-1] # /////////////////////////////////////////////////////////////////////////// if isTest: P = list(map(int, input().split())) outFile = open("output.txt", "w") # 盤面を動かす関数 def moveGrid(grid): for i in range(1, 60): for j in range(25): grid[i - 1][j] = grid[i][j] if i == 59: grid[i][j] = (0, 0, 0) # 敵までの距離を求める関数 def distance(grid, now): if not 0 <= now <= 24: return -1 for i in range(60): if grid[i][now][0]: return i return -1 # 列で得られるポイントを求める関数 def totalPoint(grid, idx): if not 0 <= idx <= 24: return -1 total = 0 dist = 0 for i in range(60): if grid[i][idx][0]: if grid[i][idx][0] > (i - dist) * (total_power // 100 + 1): break dist = i total += grid[i][idx][2] else: return total if total == 0: return -100 else: return total you = 12 move = ["S", "R", "L"] score = 0 turn = 0 total_power = 0 grid = [[(0, 0, 0) for _ in range(25)] for _ in range(60)] one = 1 while True: n = int(input()) if n == -1: break enemy = [list(map(int, input().split())) for _ in range(n)] moveGrid(grid) for h, p, x in enemy: grid[59][x] = (h, p, h) ans = 0 center = totalPoint(grid, you) left = totalPoint(grid, you - 1) right = totalPoint(grid, you + 1) if sum([i for i in [center, left, right] if i != -1]) == 0: if you == 0 or you == 24: one *= -1 ans = one if one == 1: dist = distance(grid, you + 1) else: dist = distance(grid, you - 1) elif center == 0: if left == -100 and right == -100: ans = 0 dist = distance(grid, you) elif left > right: ans = -1 dist = distance(grid, you - 1) else: ans = 1 dist = distance(grid, you + 1) else: if center >= left and center >= right: ans = 0 dist = distance(grid, you) elif left >= center and left >= right: ans = -1 dist = distance(grid, you - 1) elif right >= center and right >= left: ans = 1 dist = distance(grid, you + 1) you = you + ans if dist != -1: grid[dist][you] = ( grid[dist][you][0] - (total_power // 100 + 1), grid[dist][you][1], grid[dist][you][2], ) if grid[dist][you][0] <= 0: score += grid[dist][you][2] total_power += grid[dist][you][1] grid[dist][you] = (0, 0, 0) if isTest: outFile.write(move[ans] + "\n") outFile.write("#" + str(score) + "\n") else: print(move[ans], flush=True) turn += 1 if turn == 1000: break if isTest: outFile.close()