#K81622. Approximately Equal Dictionaries

    ID: 35795 Type: Default 1000ms 256MiB

Approximately Equal Dictionaries

Approximately Equal Dictionaries

You are given two dictionaries \(A\) and \(B\) along with a tolerance value \(t\). The dictionaries are considered approximately equal if they have exactly the same set of keys and for each key \(k\) in the dictionaries, the following inequality holds:

\( |A[k] - B[k]| \le t \)

If either the set of keys differ or any corresponding value pair fails this inequality, the dictionaries are not approximately equal.

Your task is to determine whether the two dictionaries are approximately equal. Print YES if they are approximately equal; otherwise, print NO.

inputFormat

The input is given via standard input and has the following format:

  1. An integer \(m\) representing the number of key-value pairs in dictionary \(A\).
  2. \(m\) lines follow, each containing a key (a string without spaces) and a floating point number separated by space, representing a key-value pair of \(A\).
  3. An integer \(n\) representing the number of key-value pairs in dictionary \(B\).
  4. \(n\) lines follow, each containing a key and a floating point number separated by space, representing a key-value pair of \(B\).
  5. A floating point number \(t\) representing the tolerance.

Note that the keys in the dictionaries are case-sensitive.

outputFormat

Output a single line via standard output: YES if the two dictionaries are approximately equal; otherwise, output NO.

## sample
3
apple 10.5
banana 20.3
cherry 5.2
3
apple 10.6
banana 20.2
cherry 5.0
0.3
YES