#if __INCLUDE_LEVEL__ == 0 #include __BASE_FILE__ map, bool> cache; bool Wins(vector a) { ranges::sort(a, greater{}); while (Len(a) && a.back() == 1) a.pop_back(); if (auto it = cache.find(a); it != cache.end()) return it->second; for (int i : Rep(0, Len(a))) { bool all_x = true; for (int x : Rep(1, a[i])) { int y = a[i] - x; bool exists_z = false; for (int z : {x, y}) { auto b = a; b[i] = z; if (!Wins(b)) { exists_z = true; break; } } if (!exists_z) { all_x = false; break; } } if (all_x) return cache[a] = true; } return cache[a] = false; } bool Loses(const vector& a) { int g = 0; for (int64_t e : a) g ^= e == 3 ? 2 : e % 5 == 2 || e % 5 == 3; return g == 0; } void Solve() { int n; IN(n); vector a(n); IN(a); OUT(Loses(a) ? "Second" : "First"); } // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 // 0 0 1 2 0 0 0 1 1 0 0 0 1 1 int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int t; IN(t); while (t--) { Solve(); } } #elif __INCLUDE_LEVEL__ == 1 #include template class Fix { public: explicit Fix(F f) : f_(std::move(f)) {} template decltype(auto) operator()(Ts&&... xs) { return f_(std::ref(*this), std::forward(xs)...); } template decltype(auto) operator()(Ts&&... xs) const { return f_(std::ref(*this), std::forward(xs)...); } private: F f_; }; template concept MyRange = std::ranges::range && !std::convertible_to && !std::convertible_to; template concept MyTuple = std::__is_tuple_like::value && !MyRange; namespace std { istream& operator>>(istream& is, MyRange auto&& r) { for (auto&& e : r) { is >> e; } return is; } istream& operator>>(istream& is, MyTuple auto&& t) { apply([&](auto&... xs) { (is >> ... >> xs); }, t); return is; } ostream& operator<<(ostream& os, MyRange auto&& r) { auto sep = ""; for (auto&& e : r) { os << exchange(sep, " ") << forward(e); } return os; } ostream& operator<<(ostream& os, MyTuple auto&& t) { auto sep = ""; apply([&](auto&... xs) { ((os << exchange(sep, " ") << xs), ...); }, t); return os; } } // namespace std template class OneBased { public: explicit OneBased(T&& x) : ref_(std::forward(x)) {} template requires(sizeof...(Ts) > 1) OneBased(Ts&&... xs) : ref_(std::forward_as_tuple(std::forward(xs)...)) {} friend std::istream& operator>>(std::istream& is, OneBased x) { if constexpr (MyRange) { for (auto&& e : x.ref_) { is >> ::OneBased(e); } } else if constexpr (MyTuple) { std::apply([&](auto&... xs) { (is >> ... >> ::OneBased(xs)); }, x.ref_); } else { is >> x.ref_; --x.ref_; } return is; } friend std::ostream& operator<<(std::ostream& os, OneBased x) { if constexpr (MyRange) { auto f = [](auto&& e) { return ::OneBased(std::forward(e)); }; os << (x.ref_ | std::views::transform(f)); } else if constexpr (MyTuple) { std::apply([&](auto&... xs) { os << std::tuple(::OneBased(xs)...); }, x.ref_); } else { os << ++x.ref_; --x.ref_; } return os; } private: T ref_; }; template OneBased(T&&) -> OneBased; template OneBased(Ts&&...) -> OneBased>; using namespace std; #define Rep(...) [](int l, int r) { return views::iota(min(l, r), r); }(__VA_ARGS__) #define Len(r) int(size(r)) #define IN(...) (cin >> forward_as_tuple(__VA_ARGS__)) #define OUT(...) (cout << forward_as_tuple(__VA_ARGS__) << '\n') #endif // __INCLUDE_LEVEL__ == 1