#include <iostream>
#include <string>
#include <iterator>
#include <vector>
#include <algorithm>
#include <cmath>

int main (void)
{
    int times;
    std::cin >> times;
    for ( int index = 0; index < times; ++index ) {
        int n;
        bool truth = false;
        std::string str;
        std::cin >> n >> str;
        if ( str[0] == '2' ) {
            if ( str[1] == '0' ) {
                if ( str[2] == '2' ) {
                    if ( str[3] == '0' ) {
                        truth = true;
                    } else {
                        if ( str[str.length() - 1] == '0' ) {
                            truth = true;
                        }
                    }
                } else {
                    if ( str[str.length() - 2] == '2' && str[str.length() - 1] == '0' ) {
                        truth = true;
                    }
                }
            } else {
                if ( str[str.length() - 3] == '0' && str[str.length() - 2] == '2' && str[str.length() - 1] == '0' ) {
                    truth = true;
                }
            }
        } else {
            if ( str[str.length() - 4] == '2' && str[str.length() - 3] == '0' && str[str.length() - 2] == '2' && str[str.length() - 1] == '0' ) {
                truth = true;
            }
        }
        if ( truth ) {
            std::cout << "YES" << std::endl;
        } else {
            std::cout << "NO" << std::endl;
        }
    }
    return 0;
}