TopCoder

User's AC Ratio

NaN% (0/0)

Submission's AC Ratio

NaN% (0/0)

Tags

Description

Nova sniffs a highly-encrypted communication channel between Jim Raynor and Tosh. Since Nova has a Psi Index rating of 10, she is a powerful telepath and has telekinetic abilities so she did decrypt the messages and found Tosh's ambition to build a spectre army, and that attacking New Folsom would essentially be releasing psychopaths into the galaxy. Nova want to break Tosh's deal, so she decided to inject her own message into this channel.

Since Nova has a Psi Index at rating of 10, she could easily change any bits transferred in this channel. Unfortunately, Jim's channel has highly-encrypted and it has a certification protocol for their messages. So when Nova changed the bits, the certificate protocol will find it and correct it (second-in-command: we suffered some psionic interrupt). But Nova is so smart and has her psionic abilities, she found that the certificate protocol in the channel is signed for each 32-bits. And Nova has sniffed for a long time, now she found some rules that if she convert some special bits for a 32-bits message in some ways, the certificate protocol are not able to distinguish the change. Now, Nova want to inject her video message into the channel between Raynor and Tosh to break this situation. Nova has a high-confidence that she would win this negotiation since it's just a so simple decision between a blond-hair girl and a afro nigger, where most of people do choice the former at that time. So now, Nova is going to find whether she could inject her messages.

Input Format

The input contains several test cases. The first line of input contains an integer T which means there are totally T test cases in this input.

In each test case, it following by a line contains 2 integers N and R. The following 2N lines are the representation of the 32-bits streams. The first N lines are the original messages in the channel between Raynor and Tosh, and the later N lines are the messages Nova wanna change to. Each line contains a "01"-string with length 32, represents a 32-bits message in the streams.

Then, there are following R lines represents the rules found by Nova. Each line is a rule represented by a 32-bits "01"-string. The "1" bits in the rule means if some message are converted at all the positions of "1" bits, the original and converted messages are not distinguishable by the channel's certification protocol. The conversion of a bit means the change from "0" to "1" and "1" to "0".

For example:


  • The message "00001111" changed by rule "01010101" is converted to "01011010".

  • The message "00110011" changed by rules "00110011" and "01010101" is converted to "01010101".


Limit:

  • 0 <= T <= 20

  • 0 <= N <= 200

  • 0 <= R <= 100

Output Format

If Nova could change the original stream by what she injected, she would say "Nova here."
Otherwise, she would say "This is Nova, signing off."

Sample Input 1

2
2 2
00001111000000000000000000000000
00110011000000000000000000000000
01011010000000000000000000000000
01010101000000000000000000000000
01010101000000000000000000000000
00110011000000000000000000000000
1 1
00000000000000000000000000000000
11111111111111111111111111111111
01010101010101010101010101010101

Sample Output 1

Nova here.
This is Nova, signing off.

Hints

"Your actions are embarrassing both of us."

Problem Source

Migrated from old NTUJ.

CA

Subtasks

No. Testdata Range Score

Testdata and Limits

No. Time Limit (ms) Memory Limit (VSS, KiB) Output Limit (KiB) Subtasks
0 2000 262144 6