Wire-compatible Protocol buffer

아직 제출이 없습니다시간 제한3초메모리 제한256 MB

문제

Protocol buffers (or protobuf) are a flexible, efficient, automated mechanism for serializing structured data -- think XML, but smaller, faster and simpler. In this problem, we will discuss the wile-compatible problem on a simplified protocol buffer.

입력

The first line contains an integer nn indicates the number of lines of a protobuf descriptor.

The following nn lines are the content of the protobuf descriptor which contains a set of messages. Each line will not contain more than 120 characters.

Then follows a line with an integer mm (1m500001 \le m \le 50000), indicating there are mm wire-format compatibility queries.

Then follow mm lines, each of which is a wire-format compatibility query with two message names.

It is guaranteed that the descriptor is valid, in other words, no two messages have the same name, no two fields in a message have the same field name or tag number, and each message type in a field must be one of the existing message names.

There will be at most 1000 messages in the descriptor, and each message will have at most 16 fields.

All tokens of the input are separated by spaces.

출력

For each query, output one line containing "Wire-format compatible." (quotes for clarity) if the two messages in this query are wire-format compatible, or otherwise, "Wire-format incompatible." (quotes for clarity)

힌트

In the first example:

  • For Test1 and Test2, though the two messages have different field names, the serialized message just cares about their field numbers.
  • For Test1 and Test3, the same field name as the two messages have, their field numbers do not match.
  • For Test1 and Test4, obviously required is incompatible with optional.
  • For Test1 and Test5, not all valid UTF-8 strings are valid messages, and vice versa.