using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
class Program
{
    static int razliciti(int n)
    {
        int brr = 10;
        List<int> bili = new List<int>();
        for(int i = 25; i <= n; i++)
        {
            int br = i; int pr = 1;
            while(br > 9)
            {
                pr *= br % 10;
                br /= 10;
            }
            pr *= br;
            bili.Add(pr);
            if (pr >= 10 || !bili.Contains(pr)) brr++;
        }
        return brr;
    }
    static void Main(string[] args)
    {
        int t = int.Parse(Console.ReadLine());
        for(int i = 0; i < t; i++)
        {
            int n = int.Parse(Console.ReadLine());
            if (n <= 10) Console.WriteLine(n);
            else if(n < 25) Console.WriteLine(10);
        }
    }
}