def move(x, y, size):
for i in range(0,size):
for j in range(0,size):
if i == x and j == y:
print('( here )',end = ' ')
else:
print('(', i + 1 , ', ', j + 1 , ')',end = ' ')
print()
#ํฌ๊ธฐ
size = int(input()) + 1
#๋ช
๋ น
com = map(str, input().split())
#ํ์ฌ ์์น
x, y = 0, 0
#๋, ๋ถ, ์, ๋จ
dx = [0, -1, 0, 1]
dy = [1, 0, -1, 0]
move_types = {'R' : 0,
'U' : 1,
'L' : 2,
'D' : 3
}
temp_y = 0
temp_x = 0
move(x, y, size)
print()
for i in com:
print(dx[move_types[i]], ',' , dy[move_types[i]])
temp_x = x + dx[move_types[i]]
temp_y = y + dy[move_types[i]]
if temp_x < 0 or temp_x > size or temp_y < 0 or temp_y > size:
continue
x = temp_x
y = temp_y
move(x, y, size)
print()
print('(', x + 1, ',', y +1 , ')')
5
R R R U D D
( here ) ( 1 , 2 ) ( 1 , 3 ) ( 1 , 4 ) ( 1 , 5 ) ( 1 , 6 )
( 2 , 1 ) ( 2 , 2 ) ( 2 , 3 ) ( 2 , 4 ) ( 2 , 5 ) ( 2 , 6 )
( 3 , 1 ) ( 3 , 2 ) ( 3 , 3 ) ( 3 , 4 ) ( 3 , 5 ) ( 3 , 6 )
( 4 , 1 ) ( 4 , 2 ) ( 4 , 3 ) ( 4 , 4 ) ( 4 , 5 ) ( 4 , 6 )
( 5 , 1 ) ( 5 , 2 ) ( 5 , 3 ) ( 5 , 4 ) ( 5 , 5 ) ( 5 , 6 )
( 6 , 1 ) ( 6 , 2 ) ( 6 , 3 ) ( 6 , 4 ) ( 6 , 5 ) ( 6 , 6 )
0 , 1
( 1 , 1 ) ( here ) ( 1 , 3 ) ( 1 , 4 ) ( 1 , 5 ) ( 1 , 6 )
( 2 , 1 ) ( 2 , 2 ) ( 2 , 3 ) ( 2 , 4 ) ( 2 , 5 ) ( 2 , 6 )
( 3 , 1 ) ( 3 , 2 ) ( 3 , 3 ) ( 3 , 4 ) ( 3 , 5 ) ( 3 , 6 )
( 4 ,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