#include using namespace std; #define endl "\n" #define ll long long #define all(v) v.begin(), v.end() #define pb push_back #define sz(v) v.size() #define vi vector #define vvi vector> #define mpi map const int INF=(1>>30); int N=1e6; bool isPrime(int num){ bool flag=true; for(int i = 2; i * i <= num; i++) { if(num % i == 0){ flag = false; break; } } return flag; } bool isVowel(char ch){ if(ch=='a' || ch=='e' || ch=='i' || ch=='o' || ch=='u') return true; return false; } // MODULAS const int mod=1e9+7; long long modular(long long x){ return ((x%mod + mod)%mod); } long long add(long long a, long long b){ return modular(modular(a)+modular(b)); } long long mul(long long a, long long b){ return modular(modular(a)*modular(b)); } ll modPow(ll a, ll b){ if(b==0) return 1LL; if(b==1) return a%mod; ll res=1; while(b){ if(b%2==1) res=mul(res,a); a=mul(a,a); b=b/2; } return res; } ll modpow(ll b, ll p, ll m){ ll r = 1; while(p){ if(p & 1) r = r*b%m; b = b*b%m; p /= 2; } return r; } bool sortbysec(const pair &a,const pair &b){ return (a.second < b.second); } ll getProduct(ll n){ if(n == 0){ return 1 ; } return (n%10) * getProduct(n/10) ; } ll digitSum(ll n){ ll total=0; while(n){ total+=n%10; n=n/10; } return total; } ll LargestDigit(ll n){ ll largest = -1; while(n){ ll r = n % 10; largest = max(r, largest); n /=10; } return largest; } ll ceil(ll n){ if(n % 2 == 0){ return n / 2; } return n / 2 + 1; } void SieveOfEratosthenes(int n){ bool prime[n+1]; memset(prime, true, sizeof(prime)); for (int p=2; p*p<=n; p++){ if(prime[p] == true){ for (int i=p*2; i<=n; i += p) prime[i] = false; } } for (int p=2; p<=n; p++) if (prime[p]) cout << p << " "; } bool isPalindrome(ll n) { string s= to_string(n); string t= s; reverse(all(t)); return s==t; } string intobinary(int n) { return bitset<8>(n).to_string(); } bool isPowerOfTwo (ll x){ return x && (!(x&(x-1))); } ll factorial(ll n){ return (n==1 || n==0) ? 1:( n *((ll) factorial(n - 1))); } ll gcd(ll a, ll b){ if(b==0) return a; return gcd(b,a%b); } ll lcm(ll a,ll b){ return (a*b)/gcd(a,b); } char to_upper (char x){ if( 97 <= int(x) && int(x) <= 122) return char(x-32); if( 65 <= int(x) && int(x) <= 90) return x; return -1; } char to_lower (char x){ if( 97 <= int(x) && int(x) <= 122) return x; if( 65 <= int(x) && int(x) <= 90) return char(x+32); return -1; } int numerize (char x){ if(48 <= int(x) && int(x) <= 57) return int(x-'0'); if(97 <= int(x) && int(x) <= 122) return int(x-96); if(65 <= int(x) && int(x) <= 90) return int(x-64); return -1; } int chartoint(char x){ return int(x-'0'); } string inttostring(ll x){ return to_string(x); } bool isarraySorted(ll arr[], ll n) { if (n == 0 || n == 1) return true; for (ll i = 1; i < n; i++) { if (arr[i - 1] > arr[i]) { return false; } } return true; } bool isvectorSorted(vector arr) { int n=arr.size(); if (n == 0 || n == 1) return true; for (ll i = 1; i < n; i++) { if (arr[i - 1] > arr[i]) { return false; } } return true; } bool isPerfectSquare(ll x){ if (x >= 0) { ll sr = sqrt(x); return (sr * sr == x); } return false; } ll reverse(ll n) { ll r, rev = 0; while (n > 0) { r = n % 10; rev = rev * 10 + r; n = n / 10; } return rev; } bool isPal(string S){ for (int i = 0; i < S.length() / 2; i++) { if (S[i] != S[S.length() - i - 1]) { return false; } } return true; } ll lastdigit(ll n){ ll rem=n%10; return rem; } ll countDigit(ll n) { string num = to_string(n); return num.size(); } ll arraySum(ll a[], ll n) { ll initial_sum = 0; return accumulate(a, a+n, initial_sum); } ll vectorSum(vector a, ll n) { ll initial_sum = 0; return accumulate(a.begin(), a.end(), initial_sum); } ll binaryToDecimal(string n){ string s= n; ll dec_value = 0; ll base = 1; ll len = sz(s); for (int i = len - 1; i >= 0; i--) { if (s[i] == '1') dec_value += base; base = base * 2; } return dec_value; } ll nextPerfectSquare(ll n){ if (ceil((double)sqrt(n)) == floor((double)sqrt(n))){ return n*n; } ll nextN = floor(sqrt(n)) + 1; return nextN * nextN; } ll firstDigit(ll n){ while (n >= 10) n /= 10; return n; } vector SieveOfEratosthenes(ll n,vector&mem){ vector prime(n + 1, 1); for (ll p = 2; p * p <= n; p++){ if (prime[p]){ for (ll i = p * p; i <= n; i += p) prime[i] = false; } } prime[1] = 0; prime[0] = 0; for(int i=2; i<=n; i++){ if(prime[i]) mem.pb(i); } return mem; } void dfs(int node,vector adj[],vector& vis){ vis[node]=1; for(auto it:adj[node]){ if(!vis[it]){ dfs(it,adj,vis); } } } void solve(){ string s; cin>>s; set st; for(auto it:s) st.insert(it); if(st.size()==2){ cout<<"Yes"<>tc; while(tc--){ solve(); } }