Help me in solving MAKEDIV3 problem

My issue

what is issue in my code

My code

#include <bits/stdc++.h>
using namespace std;
#include<math.h>

int main() {
    long long int T,N,X;
    cin>>T;
    while(T--){
        cin>>N;
       
        long long int i=pow(10,N-1);
        while(i<pow(10,N)){
            
            if(i%3==0 && i%9!=0 && i%2!=0){
                cout<<i<<endl;
                break;
            }
            i++;
        }
    }

}

Learning course: Jump from 2* to 3*
Problem Link: Make it Divisible Practice Problem in Jump from 2* to 3* - CodeChef

@lavkeshmeena
the logic is print n-1 times 9 and one time 3

in your code integer overflow will occur as constraints are from 0 to 10^4.
the logic would be to print 3 if n==1 else print 9 n-1 times and then print 3