2161 DS is lonely...

Source: Internet
Author: User
Description

In Beihang, In the 1006ws team, DS is the only person without a sister... After seeing AR, Cong Mei expressed envy, envy, hate, and emptiness and loneliness. Finally, he decided not to let it go... I hope everyone can support it.

When I got there, DS said it hurt again... That guy, it's all back! Not to mention anything else, the requirements are extremely high, he said the pressure is very heavy. He pulled a list to see if there were any sisters he could accept... DS scores every girl (although it is basically the appearance score... He will not consider anything lower than a certain value.

But the girl doesn't have to be him. Sisters agree that a man has objective attribute values that must be considered (the higher the value, the better ), each sister has different requirements on each attribute value (for example, Sister X may have a high requirement on the attribute of a, which must be higher than 90 points; and Sister y may think that higher than 60 is enough ). That is to say, each sister has her own set of standards. Only when all attributes meet the requirements will a sister not turn off the lights.

... DS indicates... Lonely... I beg you to help me select some girls who can be awesome and "light.

Input

The first line is an integer T, representing a total of T groups of test data.

For each group of test data:

The first line is an integer N, representing a total of N sisters.

The number of N in the second row indicates that DS impressed the sisters.

In the third row, two numbers, M and S, indicate that the sister examines M attribute values in total, and the impression score of the DS requirement sister (the sister's impression score cannot be smaller than this ).

The number of M in the fourth row represents the attribute values of DS.

In the next n rows, each row has a string name and M number, representing the sister's name and their requirements for each attribute (each attribute of DS must be greater than their requirements, they won't turn off the lights ).

P.s. The score of Shenma is 1 ~ An integer of 100. The name cannot exceed 100 characters long and has no white space in the middle.

T ≤ 100, n ≤ 200, m ≤ 500

Output

For each data, refer to the sample output form to output the names of all sisters that DS thinks are awesome and comply with the requirements in the original order.

If no sister meets the requirements, output "ds Will lonely. OMG !"

Sample Input
2
2
2 4
1 3
5
Ar 4
Wencong 6
3
100 0 90
2 80
75 95
Candybox 80 91
Sisterfeng 100 100
Ta 74 80 sample output
Stage 1:
DS Will lonely. OMG!
Stage 2:
Ta prompt
The first group of data, because gay is strictly prohibited, DS continues to be lonely.

Pay attention to the reading questions about> and ≥0.

Simple question Simulation

 
# Include <stdio. h> int main () {int number, T; int N, I, j; int M, s; int N1 [201]; int m1 [501]; int need [501]; char name [102]; int flag; scanf ("% d", & number); For (t = 1; t <= number; t ++) {flag = 0; printf ("stage % d: \ n", T); scanf ("% d", & N); for (I = 0; I <n; I ++) {scanf ("% d", & N1 [I]);} scanf ("% d", & M, & S ); for (I = 0; I <m; I ++) {scanf ("% d", & m1 [I]) ;}for (I = 0; I <N; I ++) {scanf ("% s", & name); For (j = 0; j <m; j ++) {scanf ("% d ", & need [J]);} If (N1 [I]> = s) {for (j = 0; J <m; j ++) {If (need [J]> = m1 [J]) break;} If (j = m) {flag = 1; printf ("% s \ n", name) ;}}if (flag = 0) {printf ("ds Will lonely. OMG! \ N ") ;}} return 0 ;}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.