#include constexpr int a[] = {1, 2, 5, 6, 5, 6, 7, 0, 1, 0}; inline int solve() noexcept { int64_t n; std::cin >> n; if(n == 0) { return 2; } return a[n % 10]; } int main() { std::cin.tie(nullptr) -> sync_with_stdio(false); int t; std::cin >> t; while(t--) { std::cout << solve() << '\n'; } }