#include #include #include using namespace std; using ll = long long int; class unionFind{ int nodeSize; vector parent; public: unionFind(int n):nodeSize(n){ parent = vector(n+1,-1); } int getRoot(int a){ if(parent[a] < 0){ return a; } return parent[a] = getRoot(parent[a]); } bool isSameParent(int a,int b){ return getRoot(a) == getRoot(b); } bool isRoot(int a){ if(parent[a] < 0){ return true; } return false; } void unite(int a,int b){ if(isSameParent(a,b)){ return; } int aParent = getRoot(a); int bParent = getRoot(b); if(abs(parent[aParent]) > abs(parent[bParent])){ parent[aParent] += parent[bParent]; parent[bParent] = aParent; }else{ parent[bParent] += parent[aParent]; parent[aParent] = bParent; } } }; int main(){ ll a,b; cin >> a >> b; a %= b; vector used(b,-1); ll idx = 1; ll endidx; ll swidx; ll t = a; used[a] = 0; while(true){ t *= a; t %= b; if(used[t] >= 0){ endidx = idx; swidx = used[t]; break; }else{ used[t] = idx; } idx++; } string S,T; for(int i = 0; i <= endidx+1; i++){ S += 'a'; T += 'a'; } S[endidx - swidx] = 'b'; T[0] = 'b'; cout << S << endl; cout << T << endl; return 0; }