description: Moamen and Ezzat are playing a game. They create an array a of n non-negative integers where every element is less than 2^k.
  
  Moamen wins if a_1  \&  a_2  \&  a_3  \&  …  \&  a_n ≥ a_1 ⊕ a_2 ⊕ a_3 ⊕ … ⊕ a_n.
  
  Here \& denotes the [bitwise AND operation](https://en.wikipedia.org/wiki/Bitwise_operation#AND), and ⊕ denotes the [bitwise XOR operation](https://en.wikipedia.org/wiki/Bitwise_operation#XOR).
  
  Please calculate the number of winning for Moamen arrays a.
  
  As the result may be very large, print the value modulo 1 000 000 007 (10^9 + 7).
  
  Input
  
  The first line contains a single integer t (1 ≤ t ≤ 5)— the number of test cases. 
  
  Each test case consists of one line containing two integers n and k (1 ≤ n≤ 2⋅ 10^5, 0 ≤ k ≤ 2⋅ 10^5).
  
  Output
  
  For each test case, print a single value — the number of different arrays that Moamen wins with.
  
  Print the result modulo 1 000 000 007 (10^9 + 7).
  
  Example
  
  Input
  
  
  3
  3 1
  2 1
  4 0
  
  
  Output
  
  
  5
  2
  1
  
  Note
  
  In the first example, n = 3, k = 1. As a result, all the possible arrays are [0,0,0], [0,0,1], [0,1,0], [1,0,0], [1,1,0], [0,1,1], [1,0,1], and [1,1,1].
  
  Moamen wins in only 5 of them: [0,0,0], [1,1,0], [0,1,1], [1,0,1], and [1,1,1].
solution: // JAVA program to find sum of all divisors
  // of a natural number
  import java.io.BufferedReader;
  import java.io.IOException;
  import java.io.InputStreamReader;
  import java.math.BigInteger;
  import java.util.ArrayList;
  import java.util.Arrays;
  import java.util.Comparator;
  import java.util.PriorityQueue;
  import java.util.StringTokenizer;
  import java.util.TreeSet;
  
  
  public class new1 {
  	static int mod = 1000000007;
  	  static long power(long x, long y)
  	  {
  	    long res = 1;
  	    long p = mod;
  	    x = x % p; // Update x if it is more than or
  	    // equal to p
  	 
  	    if (x == 0)
  	      return 0; // In case x is divisible by p;
  	 
  	    while (y > 0)
  	    {
  	 
  	      // If y is odd, multiply x with result
  	      if ((y & 1) != 0)
  	        res = (res * x) % p;
  	 
  	      // y must be even now
  	      y = y >> 1; // y = y/2
  	      x = (x * x) % p;
  	    }
  	    return res;
  	  }
  	  
  	public static long func(int n, int k, long dp[]) {
  		//System.out.println(k);
  		if(k == 0) return 1;
  		if(dp[k] != -1) return dp[k];
  		long a1 = 0; long a2 = 0; long a3 = 0;
  		if(n % 2 == 0) {
  			long f = power(2, n);
  			f = power(f, k - 1);
  			a1 =  f;
  		}
  		else {
  			a2 =  func(n, k - 1, dp);
  		}
  		long tot = n - 1;
  		long f = power(2, tot);
  		if(n % 2 == 0) f = f - 1;
  		a3 = f;
  		a3 = (a3 * func(n, k - 1, dp)) % 1000000007;
  		long ans = (a1 + a2 + a3) % 1000000007;
  		//System.out.println(a1 + " " + a2 + " " + a3 + " " + k);
  		dp[k] = ans;
  		return ans;
  	}
  	
  	public static void main(String[] args)
  	{
  		FastReader s = new FastReader();
  		int t = s.nextInt();
  		for(int i = 0; i < t; i++) {
  			int n = s.nextInt();
  			int k =s.nextInt();
  			long[] dp = new long[k + 1];
  			Arrays.fill(dp,  -1);
  			for(int j = 0; j <= k; j++) {
  				func(n, j, dp);
  			}
  			long ans = func(n, k, dp);
  			//System.out.println(Arrays.toString(dp));
  			System.out.println(ans);
  		}
  	}
  }
  class FastReader {
      BufferedReader br;
      StringTokenizer st;
      public FastReader() {
          br = new BufferedReader(new InputStreamReader(System.in));
      }
      String next() {
          while (st == null || !st.hasMoreElements()) {
              try {
                  st = new StringTokenizer(br.readLine());
              } catch (IOException e) {
                  e.printStackTrace();
              }
          }
          return st.nextToken();
      }
   
      public int nextInt() {
          return Integer.parseInt(next());
      }
   
      long nextLong() {
          return Long.parseLong(next());
      }
   
      double nextDouble() {
          return Double.parseDouble(next());
      }
   
      String nextLine() {
          String str = "";
          try {
              str = br.readLine();
          } catch (IOException e) {
              e.printStackTrace();
          }
          return str;
  }}
  
  