Beginner800

Above the Clouds

Codeforces
View on Codeforces
Time: 2 secondsMemory: 256 megabytes

You are given a string s of length n, consisting of lowercase letters of the Latin alphabet. Determine whether there exist three non-empty strings a, b, and c such that:

Input

Each test consists of multiple test cases. The first line contains a single integer t (1 ≤ t ≤ 10^4) — the number of test cases. The description of the test cases follows.The first line of each test case contains a single integer n (3 ≤ n ≤ 10^5) — the length of the string s. The second line of each test case contains the string s of length n, consisting of lowercase letters of the Latin alphabet. It is guaranteed that the sum of n across all test cases does not exceed 2 · 10^5.

Output

For each test case, output "Yes" if there exist three non-empty strings a, b, and c that satisfy the conditions, and "No" otherwise. You may output the answer in any case (upper or lower). For example, the strings "yEs", "yes", "Yes", and "YES" will be recognized as positive answers.

Examples

Input
12 3 aaa 3 aba 3 aab 4 abca 4 abba 4 aabb 5 abaca 5 abcda 5 abcba 6 abcbbf 6 abcdaa 3 abb
Output
Yes No Yes No Yes Yes Yes No Yes Yes Yes Yes

Note

In the first test case, there exist unique non-empty strings a, b, and c such that a + b + c = s. These are the strings a = "a", b = "a", and c = "a". The concatenation of strings a and c equals a + c = "aa". The string b is a substring of this string. In the sixth test case, one can choose a = "a", b = "ab", and c = "b". The concatenation of strings a and c equals a + c = "ab". The string b is a substring of this string. In the seventh test case, one can choose a = "ab", b = "a", and c = "ca". The concatenation of strings a and c equals a + c = "abca". The string b is a substring of this string.

constructive algorithmsgreedystrings

Discussion

(0)
Sign in to join the discussion.
Loading editor...
0 online