Help ram @ABACUS .... can anyone check which case i m missing ??

#include<stdio.h>
#include<math.h>

int checkprime(long long x)
{
long long j,flag=0;
for(j=2;j<=sqrt(x);j++)
{
if(x%j==0)
{
flag=-1;
break ;
}
}
return flag ;
}

long long divisor(long long i)
{
long long j,m=-1;
int a,b;
for(j=2;j<=sqrt(i);j++)
{
if(i%j==0)
{
a=checkprime(j);
b=checkprime(i/j);
if((a==0) && (b==0))
{
m=i;
break ;
}
}
}
return m ;
}

int main()
{
long long a,b,t,i,j,k;
scanf("%lld", &t);
while(t–)
{
scanf("%lld %lld", &a ,&b);
for(i=b;i>=a;i–)
{
j=divisor(i);
if(j!=-1)
{
printf("%lld\n",j);
break ;
}
}
if(j==-1)
printf("%lld\n",j);
}
return 0 ;
}

Your solution is giving wrong answer in the following test case
A=9 and B=90. Your answer is 87 but the correct answer is 90.