#include <iostream>
#include <string>
using namespace std;
struct student {
string name, surname;
int average;
void inputFullName() {
cin >>surname >>name;
}
void printFullName() {
cout <<surname <<" " <<name <<endl;
}
void inputMarks() {
int subjects, mark;
long sum = 0;
cin>> subjects;
//ввод оценок в нужном количестве и подсчет суммы
for (auto j = 0; j < subjects; j++){
cin >>mark;
sum +=mark;
}
//вычисление среднего для данного ученика
average = sum / subjects;
}
bool passCheck(int k) {
return average >= k;
}
};
int main() {
//количество учеников и средний проходной балл
int n;
cin >> n;
//массив учеников
student list[n];
for (auto i = 0; i < n; i++){
list[i].inputFullName();
list[i].inputMarks();
}
//ввод среднего проходного балла
int k;
cin >> k;
//если среднее не меньше проходного балла,
//выводим фамилию и имя данного ученика
for (auto i = 0; i < n; i++){
if (list[i].passCheck(k))
list[i].printFullName();
}
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8c3RyaW5nPgogCnVzaW5nIG5hbWVzcGFjZSBzdGQ7CiAKc3RydWN0IHN0dWRlbnQgewoJc3RyaW5nIG5hbWUsIHN1cm5hbWU7CglpbnQgYXZlcmFnZTsKCXZvaWQgaW5wdXRGdWxsTmFtZSgpIHsKCQljaW4gPj5zdXJuYW1lID4+bmFtZTsKCX0KCXZvaWQgcHJpbnRGdWxsTmFtZSgpIHsKCQljb3V0IDw8c3VybmFtZSA8PCIgIiA8PG5hbWUgPDxlbmRsOwoJfQoJdm9pZCBpbnB1dE1hcmtzKCkgewoJCWludCBzdWJqZWN0cywgbWFyazsKCQlsb25nIHN1bSA9IDA7CgkJY2luPj4gc3ViamVjdHM7CgkJLy/QstCy0L7QtCDQvtGG0LXQvdC+0Log0LIg0L3Rg9C20L3QvtC8INC60L7Qu9C40YfQtdGB0YLQstC1INC4INC/0L7QtNGB0YfQtdGCINGB0YPQvNC80YsKICAgICAgICBmb3IgKGF1dG8gaiA9IDA7IGogPCBzdWJqZWN0czsgaisrKXsKICAgICAgICAgICAgY2luID4+bWFyazsKICAgICAgICAg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