Group tournament
시간 제한2초메모리 제한1024 MB
일부 결과가 정해진 리그전 표에서 남은 경기의 결과를 정해 각 팀의 최종 승점이 주어진 값과 정확히 일치하도록 채운다.
문제
In our capitalist-run, dog-eat-dog world money is everything, and big sports are no exception. All participating teams have already bought enough points for the next season, and all the local hockey federation has to do now is distribute the results of the upcoming games. However, some teams felt generous and apart from buying points also bought the results of some matches. Initially the federation officials thought it would only make their life easier: the more games are fixed, the less work. It was only later that they understood their wrong and asked us to be a part of their scheme and help them distribute the results of the games in the upcoming season.
The local hockey tournament follows a round scheme: teams participate, each team plays a game against each and every other team strictly once. Teams score points for games according to the following rules:
- If the winning team is defined at the end of the regulation time of the match, it scores 3 points, and the other team gets none.
- If a game is tied after regulation time, overtime ensues. In this case the winner gets 2 points and the loser gets 1. The overtime is unlimited and lasts until someone scores a goal.
Based on the tournament results, a team's score is calculated as the sum of its points earned in all games played.
입력
The first line of the input file contains an integer --- the number of tournament participants (2 100). Teams are numbered from 1 to .
The following lines of the file each contain symbols and are in essence a tournament table for the given moment of time.
The symbol in the line and position denotes the result of a game scheduled to be played by team number against team number (1 , ). It can be one of the following:
'W'--- means that the team will win a match against in the regulation time'w'--- the team will win in a match against in the overtime'l'--- the team will lose to the team in the overtime'L'--- the team will lose to the team in the regulation time'.'--- if the result of the game between and is not yet determined'#'--- if equals , it means that there is no such game, i.e. a team cannot play against itself.
It is guaranteed that the table is correct. More formally:
- =
'#'for all = - if =
'.', then ='.' - =
'W'when and only when ='L' - =
'w'when and only when ='l'
The last line of the input file contains integers --- the number of points the -th team must score (1 ).
출력
The output file must contain a completely filled tournament table in the same format as that in the input file.
It is guaranteed that a solution exists. If there are several solutions, print any of them.