#include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; const int inf=1<<30; const ll INF=1LL<<62; typedef pair P; typedef pair PP; const ll MOD=998244353; ll dp[6][6][6][6][6][6][6][6]; int main(){ int N,K; cin>>N>>K; vector S(N); for(int i=0;i>S[i]; } unordered_set visited; for(auto s:S){ if(visited.count(s)){ continue; } vector stk; stk.push_back(s); while(!stk.empty()){ string s=stk.back(); stk.pop_back(); for(int i=0;i