
#include <iostream>
#include <string>

void testcase()
{
  int n;
  std::cin >> n;

  std::string _2020 = "2020";
  std::string s;
  std::cin >> s;

  int count = 0;

  for (int i = 0; i < 4; ++i)
  {
    if (s[i] == _2020[i])
      count++;
    else
      break;
  }

  for (int i = 0; i < 4; ++i)
  {
    if (s[n - 1 - i] == _2020[4 - 1 - i])
      count++;
    else
      break;
  }

  std::cout << ((count >= 4) ? "YES" : "NO") << '\n';
}

int main()
{
  int t;
  std::cin >> t;

  while (t--)
    testcase();

  return 0;
}