//            __                         //   _______ / _|_   _ _ __ _   _ ___    //  |_  / _  |_| | | |  __| | | / __|   created on   //   / /  __/  _| |_| | |  | |_|  __    18 Mar 2021 00:06:00   //  /___ ___|_|   __, |_|    __,_|___/   //               |___/                      #include<bits/stdc++.h>      using namespace std;   #define int long long      #define deb(...) cerr <<  [  << #__VA_ARGS__ <<  ] : [ , DBG(__VA_ARGS__)   void DBG() { cerr <<  ] n ;}   template<typename T, typename ...Args> void DBG(T first, Args... args)   {cerr << first; if(sizeof...(args))cerr<< ,  ; DBG(args...); }      class Math{    private:     int size;     std::vector<int> prime,spf,square_of_a_prime;    public:       Math(int size_):size(size_){     /* prime.resize(size); */     spf.resize(size);     /* square_of_a_prime.resize(size); */    }       std::vector<int> seive(){     for(int i=2;i<size;i++)prime[i]=1;     for(int i=2;i<size;i++){      if(prime[i]){       if(i*i<size)square_of_a_prime[i*i]=1;       for(int j=2;j<size;j++){        if(i*j<size) prime[i*j]=0;        else break;       }      }     }     return prime;    }       void smallest_prime_factor(){     spf.assign(size,-1);     spf[1]=1;     for(int i=2; i<size; i++){      if(spf[i]==-1){       spf[i] = i;       for(int j = 2; j*i<size; j++){        if(spf[i*j]==-1){         spf[i*j] = i;        }       }      }     }    }        int SPF(int x){     return spf[x];    }       int count_no_of_factors(int x){       // complexity is O(n^1/3)...     seive();     int ans = 1;     for(int i=0;i<size;i++){      if(prime[i]){       if(i*i*i > x)break;       int count = 1;       while(x%i==0){        count++;        x/=i;       }       ans *= count;      }     }     if(prime[x])ans*=2;     else if(square_of_a_prime[x])ans*=3;     else if(x!=1)ans*=4;     return ans;    }       std::vector<int> prime_factorize(int x){     // complexity is O(n^1/2)     std::vector<int> ff(size,0);     while(x%2==0){      ff[2]++;      x/=2;     }     for(int i=3;i*i<=x;i+=2){      while(x%i==0){       ff[i]++;       x/=i;      }     }     if(x>2)ff[x]++;     return ff;    }       std::vector<int> prime_factorize_using_seive(int x){     smallest_prime_factor();     std::vector<int> ff(size,0);     while(x!=1){      ff[spf[x]]++;      x/=spf[x];     }     return ff;    }       int phi(int n){     int result = n;     for(int i=2; i*i<=n; i++){      if (n%i==0) {       while(n%i==0) n/=i;       result-=result/i;      }     }     if (n>1) result-=result/n;     return result;    }       std::vector<int> phi_1_to_n(int n){       std::vector<int> phi(n+1);       phi[0] = 0; phi[1] = 1;       for (int i=2; i<=n; i++) phi[i]=i;          for (int i = 2; i <= n; i++) {      if (phi[i]==i) {       for (int j=i; j<=n; j+=i)        phi[j] -= phi[j]/i;      }       }     return phi;    }   };         int32_t main(){     ios_base:: sync_with_stdio(false);     cin.tie(0);     int t=1;     cin >> t;        Math m((int)1e7);    m.smallest_prime_factor();           for(int tt=1;tt<=t;tt++){     int ans= 0;       int n; cin >> n;       int k; cin >> k;          map<int,int> f;          for(int i=0;i<n;i++){         int x; cin >> x;         int y=1;      map<int,int> used;         while(x!=1){           int num = m.SPF(x);           while(x%num==0){             x/=num;        used[num]++;           }         }      for(auto ele : used){       if(ele.second&1) y*=ele.first;      }         if(f.count(y)){           ans++;           f.clear();       f[y]++;         }         else{           f[y]++;         }       }     cout << ans+1 <<   n ;     }   }