Under construction

Still being built. Things may change

Non-boring Sequences

Time limit5sMemory limit128 MB

Summary
Determine whether every contiguous subarray of a sequence has at least one element unique within that subarray, using an efficient divide and conquer approach.
Level

Medium7 of 10

Topics
Divide and conquer, Array, Recursion
Solved
No attempts yet

Problem

We were worried this statement might get too boring, so we kept it short.

A sequence is called non-boring if every one of its contiguous subsequences contains at least one unique element — an element whose value appears nowhere else in that subsequence.

Given a sequence of integers, decide whether it is non-boring.

Input

The first line contains the number of test cases TT. The test cases follow.

The first line of each test case contains the length of the sequence nn (1≤n≤200 0001 \le n \le 200\,000). The next line contains the nn elements of the sequence, separated by single spaces. Every element is a non-negative integer less than 10910^9.

Output

For each test case, print the answers in the order the test cases appear in the input. For each test case, print a single line containing either non-boring or boring.

Examples5

  1. Example 1

    Input
    4
    5
    1 2 3 4 5
    5
    1 1 1 1 1
    5
    1 2 3 2 1
    5
    1 1 2 1 1
    
    Expected output
    non-boring
    boring
    non-boring
    boring
    
  2. Example 2

    Input
    1
    1
    0
    
    Expected output
    non-boring
    
  3. Example 3

    Input
    1
    2
    999999999 999999999
    
    Expected output
    boring
    
  4. Example 4

    Input
    1
    7
    4 2 3 1 3 2 4
    
    Expected output
    non-boring
    
  5. Example 5

    Input
    3
    3
    5 5 5
    4
    7 8 7 8
    1
    42
    
    Expected output
    boring
    boring
    non-boring