#445. 宫姐没有朋友
宫姐没有朋友
Background
At 🌏 Catstar, the annual 🎓 graduation season is almost upon us!
We needed to pair up the classmates in pairs at the prom, but in this case, there were so many students at our school that we just couldn't match up classmates the traditional way, to make things easier, we devised a new way to pair up them:
- First of all, we divide the class into 2 groups, named A and B
- Then the student of group A can invite their friends in group B by sending them a letter, the students can also do the same thing at the same time
- All the letters they sent will be processed via CatEx , here we will decide which letter will be delivered
- Last but not least, as Catstar citizens, we all have a healthy friendship with each other, we can assume that everyone who received an invitation will definitely accept it, so CatEx will follow the following rule that we make sure as many as possible students were paired to process the letters
Of course, as the chief sorter of CatEx with a fully educated Catstar K-16, you have already discovered that this processing rule is not very difficult and can be done quickly by applying the dichotomous map matching algorithm you have learned
But just then, you receive a special letter
The letter is from a girl signed Hoshino Miyako, who describes herself as a severe social phobic with no friends (and therefore no one will send her a letter to invite her), so she asks you to find her a classmate who meets the following criteria to match with her
- Since Miyako is in group A, this student must be in group B
- This student should be a "playboy", i.e. the one who sends the most 📃 letters among the whole class (of course, one can sent multiple letters as his/ her will)
- While processing Miyako's request, the rule of CatEx cannot be violated, in other words, the number of pairs that successfully matched without sending Miyako's letter should be strictly less than the number of successful matches with sending Miyako's letter
- If multiple students in group B can be considered as a "playboy", and since Miyako has only given you one letter, You can send an invitation letter to any of them
Input
The first row contains two numbers a and b representing the number of students in group A (excluding Miyako) and the number of students in group B respectively
The next row contains two numbers m and n representing the number of letters sent by students in group A and the number of letters sent by students in group B respectively
The next rows, each with two numbers and represent the number of letters sent by student of group A to student of group B. The next rows are the same for group B
Constraints
Output
You need to tell whether Miyako can find a matching classmate or not, print:
Genkidashite kudasai
if so
元気出してください
otherwise, print:
Mi ~ya ane ni tomodachi wa inaida
みゃー姉に友だちはいないだ
Samples
4 4
4 4
4 2
1 1
3 2
3 1
4 4
2 4
3 3
1 2
Mi ~ya ane ni tomodachi wa inaida
2 3
1 3
1 3
1 1
1 2
2 2
Genkidashite kudasai
Explain
For sample 1, it is obvious that there are no "playboys" in group B, so Miyako has no friends /(ㄒoㄒ)/~~
And for sample 2, we can draw the following mailing diagram
Obviously, classmate #1 in group B can be considered a "playboy", and we can find the optimal match
So Miyako could have a friend ( •̀ ω •́ )y, let's cheer her on!