For this Question: Given N and K, find the lexicographically smallest string of length N using only the first K lowercase letters of the alphabet such that each letter is used at least once and no two adjacent characters are equal. 

If such a string doesn't exist, print -1.The first line of input contains a single integer, T (1 <= T <= 100).

Then T lines follow, each containing two space-separated integers, N (1 <= N <= 10<sup>5</sup>) and K (1 <= K <= 26).

It is guaranteed that sum of N over all test cases does not exceed 10<sup>6</sup>For each test case, output its answer in a new line.Sample Input:
2
2 3
3 2

Sample Output:
-1
aba, I have written this Solution Code: import java.io.*;
import java.util.*;



class Main {
	public static void main (String[] args) throws IOException{
    BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
    BufferedWriter bo=new BufferedWriter(new OutputStreamWriter(System.out));
    int t;
    try{
        t=Integer.parseInt(br.readLine());
    }
    catch(Exception e)
    {
        return;
    }
    while(t-->0)
    {
      String[] g=br.readLine().split(" ");
      int n=Integer.parseInt(g[0]);
      int k=Integer.parseInt(g[1]);
        if(k>n || (k==1) || (k>26))
        {
            if(n==1 && k==1)
            bo.write("a\n");
            else
            bo.write(-1+"\n");
        }
        else
        {
           int extra=k-2;
           boolean check=true;
           while(n>extra)
           {
               if(check==true)
               bo.write("a");
               else
               bo.write("b");

               if(check==true)
               check=false;
               else
               check=true;
               n--;
           }
           for(int i=0;i<extra;i++)
           bo.write((char)(i+99));
           bo.write("\n");
        }
    }
    bo.close();
	}
}, In this Programming Language: Java, Now tell me if this Code is compilable or not?