#C14408. Device Upgrade Checker

    ID: 44054 Type: Default 1000ms 256MiB

Device Upgrade Checker

Device Upgrade Checker

You are given a list of devices with their properties and a set of upgrade conditions. Each upgrade condition is represented by an inequality of the form \(x \geq y\), where \(x\) is a device property and \(y\) is the minimum required threshold. A device is considered to need an upgrade if it fails to meet at least one of these conditions. Note that if a device does not have a property specified in a condition, its value is considered 0.

inputFormat

The input is given via standard input (stdin). The first line contains an integer \(D\), the number of devices. Each of the next \(D\) lines describes a device. A device description starts with its name (a string) followed by an integer \(K\) that represents the number of properties for that device. Then, \(K\) pairs follow where each pair consists of a property name (a string) and its value (a number). After all devices, there is a line containing an integer \(M\), the number of upgrade conditions. Each of the following \(M\) lines contains a property name and a threshold value. A device meets a condition if its property value is greater than or equal to the threshold.

outputFormat

Output via standard output (stdout) a single line containing the names of devices that need an upgrade, separated by a single space. If every device meets all of the upgrade conditions, output the line 'All devices are up-to-date'.

## sample
2
Router1 2 RAM 16 Storage 512
Router2 2 RAM 32 Storage 1024
2
RAM 8
Storage 256
All devices are up-to-date

</p>