401365: GYM100418 E Hamilton traversal 2

Memory Limit:64 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

E. Hamilton traversal 2time limit per test1 secondmemory limit per test64 megabytesinputstandard inputoutputstandard output

You have a K-dimentional parallelepiped with dimensions N1, N2... Nk You should traversal the parallelepiped in order to visit each cell only at once and returning into the original one. In one operation you can move into the neighboring cell either by coordinate N1 N2 ... or Nk.

Input

The first line of the input contains one integer K — number of dimensions. The second line contains K integer numbers N1, N2... Nk The third line contains K integers X1, X2... Xk representing your initial position.

Constraints: The product of N1, N2... Nk will be between 1 and 106 inclusive. K will be between 2 and 10.

Output

The output should contain the word No if there is no such traversal. In the other case output the word Yes. The following lines should contain a string in the format “C <+,->” where C is the coordinate, + or - denote the increase or decrease of this coordinate respectively. Please see the samples below for the details.

ExamplesInput
3
2 2 2
1 2 2
Output
Yes
2 -
3 -
2 +
1 +
2 -
3 +
2 +
1 -

加入题单

算法标签: