This is a league based challenge.

For this challenge, multiple versions of the same game are available. Once you have proven your skills on this first version, you will access a higher league and extra rules will be unlocked.

## The Goal

This is a classic tile-based boardgame "carcassonne" with the exact same rules. The goal is to place tiles and men to a board and collect points.
The tile textures are from here

## Rules

1. Players in turns are taking a random tile to place it on the gameboard.

2. Tile must be connected to another tile and match every edge it is connected to. Restrains of the board height and width should be satisfied. First tile is placed automatically.

3. After placing a tile, player may put a man on the edge of the tile to collect points, if the block is not occupied yet.

4. Connected tile parts are creating a block.

5. The only way to multiple men to stay on the same block is if their lands would be connected AFTER men were placed.

6. If the block is closed all men are released, men that have been put on an earth are staying there till the end of the game.

7. Maximum number of men of the same player that could be on board is 6.

8. Player can also put a man on a block at the time its being closed, if it was not occupied previously, to get "fast points".

This league does not have roads, please ignore related rules.

For each tile in block the player will get points:

1 in case of the road

2 in case of the castle, and additional 2 for each shield on a castle.

At the end of the game all open blocks are also counted, but for each tile on castle player would get only 1 point, and one for shield for each CLOSED castle men on land are getting 3 points.

If there are multiple men on the block, the player with max count of men will get the points for block, if max men count is equal for some players - all of them will get the points.

Defeat Conditions

- Have a lower score.
- Provide an invalid output action including wrong coordinates or mismatching edges of tile.

## Game Input

Initial input
Line 1: 2 space separated integers numberOfPlayers and selfId, count of players and index of current player
Line 2: 2 space separated integers height and width of the board.
Input for one game turn
Players will get full board state in terms of actions players had made each turn and a single tile to place.
Line 1: Integer countOfActions to read.
Next countOfActions lines is the description of tiles in the following format:
row, col - coordinates of the tile, -1 -1 in case of tile which you would get to place in turn;
edge0 edge1 edge2 edge3 - types of tile edges, e - earth, c - castle, r - road;
center - not used in this league;
owner - player who put a man on this tile, -1 if none;
manEdge - edge the player's man stays in, in format (side+position), -1 if none. For example 0+ or 10, where - and + counts only for road type of the edge;
shield - 0 or 1 in case if castle have the bonus point from shield;
links - string description of linked edges in the format (side + edge_type), for example "0c,1c;2r,3r;2-,3+;2+,3-" where - and + are left and right sides of the road looking outwards of the tile. Here ";" is a separator between different link and "," is a separator between edges in a single link.
Last line respects to the tile for the player to place.
Output for one game turn
Line 1: row and col to put the tile, angle to rotate tile clockwise, manEdge - edge to put a man in format (side + position) similar to input.
Wrong man action will NOT lead to deactivation of the player.
Example
Tile description

row col edge0 edge1 edge2 edge3 center owner manEdge shield links

-1 -1 r c r e 0 -1 00 0 0r,2r;0+,2-;0-,2+,3e