**N** children are made to stand in a queue, where everyone is given a number **A _{i}**. Then the teacher writes a number

Given this series of numbers you have to determine whether a number

**Input:**

The first line contains T, denoting the number of test cases. Then T test cases follow. Each test case has two lines. The first line of each test case has three numbers S, N and X. The second line consists of N numbers denoting the elements of the array A.

**Output:**

For each test case in a new line print "yes" if X can be formed using the numbers in the series else print "no".

**Constraints:**

1<=T<=10

1<=N<=100000

1<=S, A_{i}, X<= 10^{18}

**Example:**

**Input:**

2

1 4 7

1 2 4 2

100 2 500

51 88

**Output:**

yes

no

**Explanation:**

In the first example, the sequence of numbers are 1, 2, 5, 12, 22. Using 2 & 5 we can form 7.

In the second example, the sequence of numbers are 100, 151 & 339. So, using these numbers we cannot form 500.

Author: whiteman

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.

Sulagna | 117 |

RUTVIKHARIPARA | 116 |

janvidavda105190 | 93 |

harshsiddhapura105461 | 93 |

devsinghindra | 80 |

PiyushPandey4 | 614 |

ASWATHAMA | 561 |

akhyasharma01 | 547 |

john_wick | 521 |

jagrit_07 | 443 |

blackshadows | 5362 |

Ibrahim Nash | 5242 |

akhayrutdinov | 5111 |

mb1973 | 4929 |

Quandray | 4598 |

Login to report an issue on this page.