The two countries of **A** and **B** are at war against each other. Both countries have **N** number of soldiers. The power of these soldiers are given by **A[i]...A[N] and B[i]....B[N]**.

These soldiers have a pecularity. They can only attack their counterpart enemies, like A[i] can attack only B[i] and not anyone else. A soldier with higher power can kill the enemy soldier. If both soldiers have same power, they both die. You need to find the count of remaining soldiers of A and B at the end of the war. Also, print the winner country.

**Input:**

The first line of the input contains a single integer **T**, denoting the number of test cases. Then **T** test case follows. Each testcase contains three lines of input:-

The number of soldiers N.

Powers of A country's soldiers A_{i} ... A_{N} separated by spaces

Powers of B country's soldiers B_{i} ... B_{N} separated by spaces

**Output:**

For each testcase, print the remaining soldiers of both A and B, and the winner country. If the remaining soldiers are equal for both countries, the war ends up draw.

See examples for more clarity.

**Constraints:**

1 <= T <= 100

1 <= N <= 2000

0 <= A_{i} <= 1000

**Example:
Input:**

3

6

1 2 3 4 5 6

6 5 4 3 2 1

1

9

8

2

2 2

5 5

3 3 DRAW

1 0 A

0 2 B

**Explanation:**

**Testcase3:** Both countries have 2 soldiers. B[0] kills A[0], B[1] kills A[1]. A has 0 soldiers alive at the end. B has both soldiers alive at the end. We print the results and B as winner.

Author: Soul_xhacker

If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.

thanuvinu94 | 238 |

the_coder95 | 215 |

ShivayLamba | 208 |

sandeep.prajapati | 129 |

Ashish Kumar Vaishy | 114 |

the_coder95 | 1441 |

RishabhTanwar1 | 1110 |

thanuvinu94 | 914 |

tathagat289 | 668 |

themanhasnoname | 620 |

blackshadows | 5331 |

Ibrahim Nash | 5219 |

akhayrutdinov | 5111 |

mb1973 | 4897 |

Quandray | 4547 |

Login to report an issue on this page.