问题3122--Color the Ball

3122: Color the Ball

[命题人 : ]
时间限制 : 1.000 sec  内存限制 : 64 MB

题目描述

There are infinite balls in a line (numbered 1 2 3 ....), and initially all of them are paint black. Now Jim use a brush paint the balls, every time give two integers a b and follow by a char 'w' or 'b', 'w' denotes the ball from a to b are painted white, 'b' denotes that be painted black. You are ask to find the longest white ball sequence.

输入

First line is an integer N (<=2000), the times Jim paint, next N line contain a b c, c can be 'w' and 'b'. There are multiple cases, process to the end of file.

输出

Two integers the left end of the longest white ball sequence and the right end of longest white ball sequence (If more than one output the small number one). All the input are less than 2^31-1. If no such sequence exists, output "Oh, my god".

样例输入 Copy

3
1 4 w
8 11 w
3 5 b

样例输出 Copy

8 11

来源/分类