import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { public static void main(String args[] ) throws Exception { Scanner sc = new Scanner(System.in); ArrayList employees = new ArrayList<>(); int l = sc.nextInt();sc.nextLine(); for(int i = 0; i < l; i++){ ArrayList projects = new ArrayList<>(); int eid = sc.nextInt();sc.nextLine(); String en = sc.nextLine(); String cn = sc.nextLine(); int pc = sc.nextInt();sc.nextLine(); for(int j = 0; j < pc; j++){ String pn = sc.nextLine(); int r = sc.nextInt();sc.nextLine(); projects.add(new Project(pn, r)); } employees.add(new Employee(eid, en, cn, pc, projects)); } int empId = sc.nextInt();sc.nextLine(); int threshold = sc.nextInt(); sc.close(); HashSet uniqueRating = uniqueRating(employees, empId); if(uniqueRating.size() == 0){ System.out.println("No Employee Found"); } else{ for (Integer i : uniqueRating) { System.out.println(i); } } ArrayList empRating = averageRatingOfEmployee(employees, threshold); if(empRating.size() == 0){ System.out.println("No Employee Found"); } else{ for (String s : empRating) { System.out.println(s); } } } public static HashSet uniqueRating(ArrayList employees, int Id){ HashSet rating = new HashSet<>(); for (Employee employee : employees) { if(employee.empId == Id){ for (Project project : employee.projects) { rating.add(project.rating); } break; } } return rating; } public static ArrayList averageRatingOfEmployee(ArrayList employees, int threshold){ ArrayList empName = new ArrayList<>(); for (Employee employee : employees) { int sum = 0; int count = 0; double avg = 0; for (Project project : employee.projects) { sum += project.rating; count++; } avg = sum / count; if(avg > threshold){ empName.add(employee.eName); } } return empName; } } class Employee{ int empId; String eName; String cName; int projectCount; ArrayList projects; public Employee(int eid, String en, String cn, int pc, ArrayList p){ this.empId = eid; this.eName = en; this.cName = cn; this.projectCount = pc; this.projects = p; } } class Project{ String pName; int rating; public Project(String pn, int r){ this.pName = pn; this.rating = r; } }