8584: Bit Transmission

内存限制:256 MB 时间限制:1 S 标准输入输出
题目类型:传统 评测方式:文本比较 上传者:
提交:1 通过:1

题目描述

NIO is good at programming. He developed an STM32 program to communicate with his robot. When he sends a number to the robot, he will send a binary string of length N, that only consists of 0 and 1 instead of a decimal number. The string is a binary representation of the decimal number NIO wants to send. However, there are some bugs on the robot's intelligent system, when someone asks the robot, it sometimes will translate a wrong digit in the binary string, therefore reporting a wrong decimal number. 

Although there are bugs inside the robot, NIO is very lazy to fix them. He can tolerate the bug until the robot constantly reports wrong decimal numbers or crashes down. To find out whether the bug fix is necessary, NIO asked the robot N times whether the k-th number in the binary string is 1. If there exists a unique string for his question, then NIO considers that there's no need of a bug fix. Note that it's possible that the same digit of the string is asked for more than 3 times and some digits will not be asked.

If at most ONCE the robot will report a wrong answer for NIO's all queries, can you figure out what binary string NIO sent?

输入格式

The first line is N, the length of the string.
Following by N lines, each line consists of an integer k and a string "YES" or "NO", denoting the robot's answer for whether the k-th digit in the binary string is 1. (The index is started from 0.)
1≤N≤105

输出格式

If the binary string can be determined, output it. Otherwise output -1, denoting that the robot will crash down.

输入样例 复制

3
0 NO
1 YES
2 YES
0 YES
1 YES
2 YES
0 YES
1 YES
2 YES

输出样例 复制

111