#include #include #include using namespace std; using namespace atcoder; using mint = modint998244353; #define rep(i,n) for (int i = 0; i < (n); ++i) #define Inf32 1000000001 #define Inf64 4000000000000000001LL long long solve(long long n){ if(n==0)return 0; string s = to_string(n); vector dp(2,vector(10)); dp[0][0] = 1; rep(i,s.size()){ vector ndp(2,vector(10)); rep(j,2){ rep(k,10){ rep(l,10){ int nj = j,nk = max(k,l); if(j==0){ if(l > s[i]-'0')break; if(l < s[i]-'0')nj = 1; } ndp[nj][nk] += dp[j][k]; } } } swap(dp,ndp); } long long res = 0; rep(i,2){ rep(j,10){ res += dp[i][j] * j; } } return res; } long long solve(long long l,long long r){ return solve(r) - solve(l-1); } int main(){ int _t; cin>>_t; rep(_,_t){ long long L,R; cin>>L>>R; cout<