## GUPTA MECHANICAL

IN THIS WEBSITE I CAN TELL ALL ABOUT TECH. TIPS AND TRICKS APP REVIEWS AND UNBOXINGS ALSO TECH. NEWS .............

## [Solution] 3SUM Codeforces Solution | Codeforces Problem Solution 2022

F. 3SUM
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

Given an array $a$ of positive integers with length $n$, determine if there exist three distinct indices $i$$j$$k$ such that ${a}_{i}+{a}_{j}+{a}_{k}$ ends in the digit $3$.

Input

The first line contains an integer $t$ ($1\le t\le 1000$) — the number of test cases.

The first line of each test case contains an integer $n$ ($3\le n\le 2\cdot {10}^{5}$) — the length of the array.

The second line of each test case contains $n$ integers ${a}_{1},{a}_{2},\dots ,{a}_{n}$ ($1\le {a}_{i}\le {10}^{9}$) — the elements of the array.

The sum of $n$ across all test cases does not exceed $2\cdot {10}^{5}$.
Output $t$ lines, each of which contains the answer to the corresponding test case. Output "YES" if there exist three distinct indices $i$$j$$k$ satisfying the constraints in the statement, and "NO" otherwise.