#AGC034A. [AGC034A] Kenken Race

[AGC034A] Kenken Race

Score : 400400 points

Problem Statement

There are NN squares arranged in a row, numbered 1,2,...,N1, 2, ..., N from left to right. You are given a string SS of length NN consisting of . and #. If the ii-th character of SS is #, Square ii contains a rock; if the ii-th character of SS is ., Square ii is empty.

In the beginning, Snuke stands on Square AA, and Fnuke stands on Square BB.

You can repeat the following operation any number of times:

  • Choose Snuke or Fnuke, and make him jump one or two squares to the right. The destination must be one of the squares, and it must not contain a rock or the other person.

You want to repeat this operation so that Snuke will stand on Square CC and Fnuke will stand on Square DD.

Determine whether this is possible.

Constraints

  • 4N200 0004 \leq N \leq 200\ 000
  • SS is a string of length NN consisting of . and #.
  • 1A,B,C,DN1 \leq A, B, C, D \leq N
  • Square AA, BB, CC and DD do not contain a rock.
  • AA, BB, CC and DD are all different.
  • A<BA < B
  • A<CA < C
  • B<DB < D

Input

Input is given from Standard Input in the following format:

NN AA BB CC DD

SS

Output

Print Yes if the objective is achievable, and No if it is not.

7 1 3 6 7
.#..#..
Yes

The objective is achievable by, for example, moving the two persons as follows. (A and B represent Snuke and Fnuke, respectively.)

A#B.#..

A#.B#..

.#AB#..

.#A.#B.

.#.A#B.

.#.A#.B

.#..#AB
7 1 3 7 6
.#..#..
No
15 1 3 15 13
...#.#...#.#...
Yes