Under construction

Still being built. Things may change

Ribbon (Easy)

Interview

Time limit1sMemory limit1024 MB

Summary
Given N ribbons with positions, lengths, and colors, find two ribbons of different colors that can be tied together, or report NO.
Level

Easy2 of 10

Topics
Brute force, Implementation
Solved
No attempts yet

Problem

You are given NN ribbons tied to points on a number line. The ii-th ribbon (1≤i≤N)(1 \le i \le N) is tied to the point XiX_i and has length LiL_i. Its color is CiC_i, which is one of R, Y, or B, meaning red, yellow, and blue.

You want to tie a knot between two ribbons. The ribbons are not elastic, so you cannot stretch them, but you can bend them. That means you can tie a knot between the ii-th and jj-th ribbons if ∣Xi−Xj∣≤Li+Lj|X_i - X_j| \le L_i + L_j (i≠j)(i \ne j). Assume the ribbons are lines with no area, and ignore the length of the knot. A knot is called beautiful when the two ribbons have different colors, that is, Ci≠CjC_i \ne C_j.

Write a program that finds two ribbon numbers that can be tied into a beautiful knot.

Input

The first line contains an integer NN.

The second line contains NN integers X1,X2,⋯ ,XNX_1, X_2, \cdots, X_N.

The third line contains NN integers L1,L2,⋯ ,LNL_1, L_2, \cdots, L_N.

The fourth line contains NN characters C1,C2,⋯ ,CNC_1, C_2, \cdots, C_N.

Output

If a valid pair exists, print YES on the first line. Otherwise, print NO.

If a valid pair exists, print the numbers of two ribbons that can be tied into a beautiful knot on the second line.

If several answers exist, you may print any of them.

Constraints

  • 2≤N≤1032 \le N \le 10^3
  • −109≤X1<X2<⋯<XN≤109-10^9 \le X_1 < X_2 < \cdots < X_N \le 10^9
  • 1≤Li≤1091 \le L_i \le 10^9
  • CiC_i is one of R, Y, B.

Examples2

  1. Example 1

    Input
    2
    1 3
    1 1
    Y R
    
    Expected output
    YES
    1 2
    
  2. Example 2

    Input
    2
    -4 1
    1 2
    B B
    
    Expected output
    NO