Two players are playing the following game.
They are alternatively putting blue and red coins on the board $2018$ by $2018$. If first player creates $n$ blue coins in a row or column, he wins. Second player wins if he can prevent it. Who will win if:
$a)n=4$;
$b)n=5$?
Note: first player puts only blue coins, and second only red.
1. **Initial Setup and Strategy for Player 1:**
   - Player 1 places the first blue coin in one of the central squares of the $2018 \times 2018$ board.
   - Player 2 places a red coin adjacent to the blue coin.

2. **Lemma 0:**
   - Consider 4 consecutive squares in a row or column where the first is red, the next 3 are blue, and the next square is empty. If it is Player 2's turn, they are forced to place a red coin in the empty square.
   - **Proof:** If Player 2 does not place a red coin in the empty square, Player 1 can place a blue coin there and win with 4 consecutive blue coins.

3. **Lemma 0':**
   - Consider 3 consecutive squares in a row or column where the first is red, the next 2 are blue, and the next two squares are empty. If it is Player 1's turn, they will place a blue coin in the first empty square, forcing Player 2 to place a red coin in the second empty square by Lemma 0.

4. **Lemma 0'':**
   - Consider 3 consecutive squares in a row or column where the first is red, the next 2 are blue, and the next two squares are empty. If it is Player 1's turn, they will place a blue coin in the second empty square, forcing Player 2 to place a red coin in the first empty square by a similar argument to Lemma 0.

5. **Lemma 1:**
   - Consider 5 consecutive squares in a row or column where the first, third, and last are empty, and the second and fourth are blue. If it is Player 2's turn, they are forced to place a red coin in the third square.
   - **Proof:** If Player 2 does not place a red coin in the third square, Player 1 can place a blue coin there, and regardless of where Player 2 places their next coin, Player 1 can form 4 consecutive blue coins.

6. **Player 1's Strategy:**
   - Player 1 places the first blue coin in one of the central squares.
   - If Player 2 places a red coin adjacent to the blue coin, Player 1 places a blue coin two squares away in a perpendicular direction, leaving one empty square between the two blue coins.
   - By Lemma 1, Player 2 is forced to place a red coin in the empty square between the two blue coins.
   - Player 1 continues this strategy, using Lemma 1 and Lemma 0' to force Player 2 to place red coins in specific positions, gradually building towards 4 consecutive blue coins.

7. **Conclusion for Part (a):**
   - By following the strategy and using the lemmas, Player 1 can force a win by creating 4 consecutive blue coins.

The final answer is Player 1 wins for \( \boxed{ n = 4 } \).