아직 만들고 있는 페이지입니다.

이 페이지는 아직 만드는 중입니다. 보이는 내용은 바뀔 수 있습니다.

Deja vu of Go Players

면접 대비

시간 제한1초메모리 제한256 MB

요약
두 사람이 각자 자기 말뚝에서 돌을 하나씩 덜어내며, 자기 말뚝을 먼저 모두 비우는 사람이 이긴다. 선공이 반드시 이길 수 있는지 판정한다.
난이도

보통10점 중 5점

유형
게임 이론, 그리디
정답자
아직 제출이 없습니다

문제

An ordinary sequence rather than magic codes? Rikka's opinion is much more important than the "truth" itself. She soon felt sleepy and fell asleep to take a trip to dreamlands in passing.

Rikka found two elders playing Go game when her sanity got back. The ethereal clouds, hardy vigorous pines, and rugged rocks shocked her. A fiction isekai! Excited Rikka's eyes ran around and around and focused on the Go chessboard in the end.

She found that the two players, wearing white and red respectively, were not playing Go game --- they divided the black and white chess pieces into some piles, and were taking turns removing them. They kept silent for her questions, so Rikka had to stand there and keep her eyes on the chessboard.

They seemed to be playing an unexpectedly simple game. The red player has nn black piles and its opponent has mm white piles at the beginning. They take turns removing any positive number of chess pieces from arbitrary one of their assigned piles. Red goes first, and the player who first removes all chess pieces assigned to oneself "wins", and the other player has to drink.

Drinking is illegal for minors in Japan, so Rikka wonders if she can ensure to win when she is the red player.

입력

The first line contains an integer T(1≤T≤100)T (1\le T \le 100) , the number of test cases. Then TT test cases follow.

The input format of each test case is as follows:

The first line contains two integers n,m(1≤n,m≤100)n,m (1\le n,m \le 100), the numbers of piles of the red and the white player, respectively.

The following line contains nn integers a_i(1≤a_i≤109)a\_i (1 \leq a\_i \leq 10^9), in which each integer indicates the number of pieces in a black pile of the red player.

The following line contains mm integers b_i(1≤b_i≤109)b\_i (1 \leq b\_i \leq 10^9), in which each integer indicates the number of pieces in a white pile of the white player.

출력

Output a string in the only line, "Yes" if the red player who moves first can ensure to win, or "No" otherwise, without quotation marks.

예제1

  1. 예제 1

    입력
    2
    3 2
    1 1 1
    2 2
    1 1
    4
    3
    
    예상 출력
    No
    Yes