#ABC291C. [ABC291C] LRUD Instructions 2

[ABC291C] LRUD Instructions 2

Score : 300300 points

Problem Statement

Takahashi is on a two-dimensional plane. Starting from the origin, he made NN moves.

The NN moves are represented by a string of length NN as described below:

  • Takahashi's coordinates after the ii-th move are:

    • (x+1,y)(x+1,y) if the ii-th character of SS is R;
    • (x1,y)(x-1,y) if the ii-th character of SS is L;
    • (x,y+1)(x,y+1) if the ii-th character of SS is U; and
    • (x,y1)(x,y-1) if the ii-th character of SS is D,

    where (x,y)(x,y) is his coordinates before the move.

  • (x+1,y)(x+1,y) if the ii-th character of SS is R;

  • (x1,y)(x-1,y) if the ii-th character of SS is L;

  • (x,y+1)(x,y+1) if the ii-th character of SS is U; and

  • (x,y1)(x,y-1) if the ii-th character of SS is D,

Determine if Takahashi visited the same coordinates multiple times in the course of the NN moves (including the starting and ending points).

Constraints

  • 1N2×1051 \leq N \leq 2\times 10^5
  • NN is an integer.
  • SS is a string of length NN consisting of R, L, U, and D.

Input

The input is given from Standard Input in the following format:

NN

SS

Output

Print Yes if Takahashi visited the same coordinates multiple times in the course of the NN moves; print No otherwise.

5
RLURU
Yes

Takahashi's coordinates change as follows: (0,0)(1,0)(0,0)(0,1)(1,1)(1,2)(0,0)\to (1,0)\to (0,0)\to (0,1)\to (1,1)\to (1,2).

20
URDDLLUUURRRDDDDLLLL
No