Language: C++

#include <bits/stdc++.h>
#include<math.h>
#include <iostream>
#include <vector>
#include <queue>

int main() {
  int N;
  cin>>N; 
  if(N==1){
    cout<<a<<endl;
  }
  else if(N==2){
    cout<<aa<<endl;
    cout<<ab<<endl;    
  }
  else if(N==3){
    cout<<aaa<<endl;
    cout<<aab<<endl;
    cout<<aba<<endl;
    cout<<abb<<endl;
  }
  else if(N==4){
    cout<<aaaa<<endl;
    cout<<aaab<<endl;
    cout<<aaba<<endl;
    cout<<aabb<<endl;
    cout<<abaa<<endl;
    cout<<abab<<endl;
    cout<<abba<<endl;
    cout<<abbb<<endl;
  }
  else if(N==5){
    cout<<aaaaa<<endl;
    cout<<aaaab<<endl;
    cout<<aaaba<<endl;
    cout<<aaabb<<endl;
    cout<<aabaa<<endl;
    cout<<aabab<<endl;
    cout<<aabba<<endl;
    cout<<aabbb<<endl;
    cout<<abaaa<<endl;
    cout<<abaab<<endl;
    cout<<ababa<<endl;
    cout<<ababb<<endl;
    cout<<abbaa<<endl;
    cout<<abbab<<endl;
    cout<<abbba<<endl;
    cout<<abbbb<<endl;
  }
  else if(N==6){
    cout<<aaaaaa<<endl;
    cout<<aaaaab<<endl;
    cout<<aaaaba<<endl;
    cout<<aaaabb<<endl;
    cout<<aaabaa<<endl;
    cout<<aaabab<<endl;
    cout<<aaabba<<endl;
    cout<<aaabbb<<endl;
    cout<<aabaaa<<endl;
    cout<<aabaab<<endl;
    cout<<aababa<<endl;
    cout<<aababb<<endl;
    cout<<aabbaa<<endl;
    cout<<aabbab<<endl;
    cout<<aabbba<<endl;
    cout<<aabbbb<<endl;
    cout<<abaaaa<<endl;
    cout<<abaaab<<endl;
    cout<<abaaba<<endl;
    cout<<abaabb<<endl;
    cout<<ababaa<<endl;
    cout<<ababab<<endl;
    cout<<ababba<<endl;
    cout<<ababbb<<endl;
    cout<<abbaaa<<endl;
    cout<<abbaab<<endl;
    cout<<abbaba<<endl;
    cout<<abbabb<<endl;
    cout<<abbbaa<<endl;
    cout<<abbbab<<endl;
    cout<<abbbba<<endl;
    cout<<abbbbb<<endl;
  }
  else if(N==7){
    cout<<aaaaaaa<<endl;
    cout<<aaaaaab<<endl;
    cout<<aaaaaba<<endl;
    cout<<aaaaabb<<endl;
    cout<<aaaabaa<<endl;
    cout<<aaaabab<<endl;
    cout<<aaaabba<<endl;
    cout<<aaaabbb<<endl;
    cout<<aaabaaa<<endl;
    cout<<aaabaab<<endl;
    cout<<aaababa<<endl;
    cout<<aaababb<<endl;
    cout<<aaabbaa<<endl;
    cout<<aaabbab<<endl;
    cout<<aaabbba<<endl;
    cout<<aaabbbb<<endl;
    cout<<aabaaaa<<endl;
    cout<<aabaaab<<endl;
    cout<<aabaaba<<endl;
    cout<<aabaabb<<endl;
    cout<<aababaa<<endl;
    cout<<aababab<<endl;
    cout<<aababba<<endl;
    cout<<aababbb<<endl;
    cout<<aabbaaa<<endl;
    cout<<aabbaab<<endl;
    cout<<aabbaba<<endl;
    cout<<aabbabb<<endl;
    cout<<aabbbaa<<endl;
    cout<<aabbbab<<endl;
    cout<<aabbbba<<endl;
    cout<<aabbbbb<<endl;
    cout<<abaaaaa<<endl;
    cout<<abaaaab<<endl;
    cout<<abaaaba<<endl;
    cout<<abaaabb<<endl;
    cout<<abaabaa<<endl;
    cout<<abaabab<<endl;
    cout<<abaabba<<endl;
    cout<<abaabbb<<endl;
    cout<<ababaaa<<endl;
    cout<<ababaab<<endl;
    cout<<abababa<<endl;
    cout<<abababb<<endl;
    cout<<ababbaa<<endl;
    cout<<ababbab<<endl;
    cout<<ababbba<<endl;
    cout<<ababbbb<<endl;
    cout<<abbaaaa<<endl;
    cout<<abbaaab<<endl;
    cout<<abbaaba<<endl;
    cout<<abbaabb<<endl;
    cout<<abbabaa<<endl;
    cout<<abbabab<<endl;
    cout<<abbabba<<endl;
    cout<<abbabbb<<endl;
    cout<<abbbaaa<<endl;
    cout<<abbbaab<<endl;
    cout<<abbbaba<<endl;
    cout<<abbbabb<<endl;
    cout<<abbbbaa<<endl;
    cout<<abbbbab<<endl;
    cout<<abbbbba<<endl;
    cout<<abbbbbb<<endl;
  }
  else if(N==8){
    cout<<aaaaaaaa<<endl;
    cout<<aaaaaaab<<endl;
    cout<<aaaaaaba<<endl;
    cout<<aaaaaabb<<endl;
    cout<<aaaaabaa<<endl;
    cout<<aaaaabab<<endl;
    cout<<aaaaabba<<endl;
    cout<<aaaaabbb<<endl;
    cout<<aaaabaaa<<endl;
    cout<<aaaabaab<<endl;
    cout<<aaaababa<<endl;
    cout<<aaaababb<<endl;
    cout<<aaaabbaa<<endl;
    cout<<aaaabbab<<endl;
    cout<<aaaabbba<<endl;
    cout<<aaaabbbb<<endl;
    cout<<aaabaaaa<<endl;
    cout<<aaabaaab<<endl;
    cout<<aaabaaba<<endl;
    cout<<aaabaabb<<endl;
    cout<<aaababaa<<endl;
    cout<<aaababab<<endl;
    cout<<aaababba<<endl;
    cout<<aaababbb<<endl;
    cout<<aaabbaaa<<endl;
    cout<<aaabbaab<<endl;
    cout<<aaabbaba<<endl;
    cout<<aaabbabb<<endl;
    cout<<aaabbbaa<<endl;
    cout<<aaabbbab<<endl;
    cout<<aaabbbba<<endl;
    cout<<aaabbbbb<<endl;
    cout<<aabaaaaa<<endl;
    cout<<aabaaaab<<endl;
    cout<<aabaaaba<<endl;
    cout<<aabaaabb<<endl;
    cout<<aabaabaa<<endl;
    cout<<aabaabab<<endl;
    cout<<aabaabba<<endl;
    cout<<aabaabbb<<endl;
    cout<<aababaaa<<endl;
    cout<<aababaab<<endl;
    cout<<aabababa<<endl;
    cout<<aabababb<<endl;
    cout<<aababbaa<<endl;
    cout<<aababbab<<endl;
    cout<<aababbba<<endl;
    cout<<aababbbb<<endl;
    cout<<aabbaaaa<<endl;
    cout<<aabbaaab<<endl;
    cout<<aabbaaba<<endl;
    cout<<aabbaabb<<endl;
    cout<<aabbabaa<<endl;
    cout<<aabbabab<<endl;
    cout<<aabbabba<<endl;
    cout<<aabbabbb<<endl;
    cout<<aabbbaaa<<endl;
    cout<<aabbbaab<<endl;
    cout<<aabbbaba<<endl;
    cout<<aabbbabb<<endl;
    cout<<aabbbbaa<<endl;
    cout<<aabbbbab<<endl;
    cout<<aabbbbba<<endl;
    cout<<aabbbbbb<<endl;
    cout<<abaaaaaa<<endl;
    cout<<abaaaaab<<endl;
    cout<<abaaaaba<<endl;
    cout<<abaaaabb<<endl;
    cout<<abaaabaa<<endl;
    cout<<abaaabab<<endl;
    cout<<abaaabba<<endl;
    cout<<abaaabbb<<endl;
    cout<<abaabaaa<<endl;
    cout<<abaabaab<<endl;
    cout<<abaababa<<endl;
    cout<<abaababb<<endl;
    cout<<abaabbaa<<endl;
    cout<<abaabbab<<endl;
    cout<<abaabbba<<endl;
    cout<<abaabbbb<<endl;
    cout<<ababaaaa<<endl;
    cout<<ababaaab<<endl;
    cout<<ababaaba<<endl;
    cout<<ababaabb<<endl;
    cout<<abababaa<<endl;
    cout<<abababab<<endl;
    cout<<abababba<<endl;
    cout<<abababbb<<endl;
    cout<<ababbaaa<<endl;
    cout<<ababbaab<<endl;
    cout<<ababbaba<<endl;
    cout<<ababbabb<<endl;
    cout<<ababbbaa<<endl;
    cout<<ababbbab<<endl;
    cout<<ababbbba<<endl;
    cout<<ababbbbb<<endl;
    cout<<abbaaaaa<<endl;
    cout<<abbaaaab<<endl;
    cout<<abbaaaba<<endl;
    cout<<abbaaabb<<endl;
    cout<<abbaabaa<<endl;
    cout<<abbaabab<<endl;
    cout<<abbaabba<<endl;
    cout<<abbaabbb<<endl;
    cout<<abbabaaa<<endl;
    cout<<abbabaab<<endl;
    cout<<abbababa<<endl;
    cout<<abbababb<<endl;
    cout<<abbabbaa<<endl;
    cout<<abbabbab<<endl;
    cout<<abbabbba<<endl;
    cout<<abbabbbb<<endl;
    cout<<abbbaaaa<<endl;
    cout<<abbbaaab<<endl;
    cout<<abbbaaba<<endl;
    cout<<abbbaabb<<endl;
    cout<<abbbabaa<<endl;
    cout<<abbbabab<<endl;
    cout<<abbbabba<<endl;
    cout<<abbbabbb<<endl;
    cout<<abbbbaaa<<endl;
    cout<<abbbbaab<<endl;
    cout<<abbbbaba<<endl;
    cout<<abbbbabb<<endl;
    cout<<abbbbbaa<<endl;
    cout<<abbbbbab<<endl;
    cout<<abbbbbba<<endl;
    cout<<abbbbbbb<<endl;
  }
  
  
}



Compiler output:
a.cc: In function 'int main()':
a.cc:9:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    9 |   cin>>N;
      |   ^~~
      |   std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146,
                 from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:11:5: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   11 |     cout<<a<<endl;
      |     ^~~~
      |     std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:11:11: error: 'a' was not declared in this scope
   11 |     cout<<a<<endl;
      |           ^
a.cc:11:14: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   11 |     cout<<a<<endl;
      |              ^~~~
      |              std::endl
In file included from /usr/include/c++/14/istream:41,
                 from /usr/include/c++/14/sstream:40,
                 from /usr/include/c++/14/complex:45,
                 from /usr/include/c++/14/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
a.cc:14:5: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   14 |     cout<<aa<<endl;
      |     ^~~~
      |     std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:14:11: error: 'aa' was not declared in this scope
   14 |     cout<<aa<<endl;
      |           ^~
a.cc:14:15: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   14 |     cout<<aa<<endl;
      |               ^~~~
      |               std::endl
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
a.cc:15:11: error: 'ab' was not declared in this scope; did you mean 'abs'?
   15 |     cout<<ab<<endl;
      |           ^~
      |           abs
a.cc:18:5: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   18 |     cout<<aaa<<endl;
      |     ^~~~
      |     std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:18:11: error: 'aaa' was not declared in this scope
   18 |     cout<<aaa<<endl;
      |           ^~~
a.cc:18:16: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   18 |     cout<<aaa<<endl;
      |                ^~~~
      |                std::endl
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
a.cc:19:11: error: 'aab' was not declared in this scope
   19 |     cout<<aab<<endl;
      |           ^~~
a.cc:20:11: error: 'aba' was not declared in this scope; did you mean 'abs'?
   20 |     cout<<aba<<endl;
      |           ^~~
      |           abs
a.cc:21:11: error: 'abb' was not declared in this scope; did you mean 'abs'?
   21 |     cout<<abb<<endl;
      |           ^~~
      |           abs
a.cc:24:5: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   24 |     cout<<aaaa<<endl;
      |     ^~~~
      |     std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:24:11: error: 'aaaa' was not declared in this scope
   24 |     cout<<aaaa<<endl;
      |           ^~~~
a.cc:24:17: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   24 |     cout<<aaaa<<endl;
      |                 ^~~~
      |                 std::endl
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
a.cc:25:11: error: 'aaab' was not declared in this scope
   25 |     cout<<aaab<<endl;
      |           ^~~~
a.cc:26:11: error: 'aaba' was not declared in this scope
   26 |     cout<<aaba<<endl;
      |           ^~~~
a.cc:27:11: error: 'aabb' was not declared in this scope
   27 |     cout<<aabb<<endl;
      |           ^~~~
a.cc:28:11: error: 'abaa' was not declared in this scope
   28 |     cout<<abaa<<endl;
      |           ^~~~
a.cc:29:11: error: 'abab' was not declared in this scope
   29 |     cout<<abab<<endl;
      |           ^~~~
a.cc:30:11: error: 'abba' was not declared in this scope
   30 |     cout<<abba<<endl;
      |           ^~~~
a.cc:31:11: error: 'abbb' was not declared in this scope
   31 |     cout<<abbb<<endl;
      |           ^~~~
a.cc:34:5: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   34 |     cout<<aaaaa<<endl;
      |     ^~~~
      |     std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:34:11: error: 'aaaaa' was not declared in this scope
   34 |     cout<<aaaaa<<endl;
      |           ^~~~~
a.cc:34:18: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   34 |     cout<<aaaaa<<endl;
      |                  ^~~~
      |                  std::endl
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
a.cc:35:11: error: 'aaaab' was not declared in this scope
   35 |     cout<<aaaab<<endl;
      |           ^~~~~
a.cc:36:11: error: 'aaaba' was not declared in this scope
   36 |     cout<<aaaba<<endl;
      |           ^~~~~
a.cc:37:11: error: 'aaabb' was not declared in this scope
   37 |     cout<<aaabb<<endl;
      |           ^~~~~
a.cc:38:11: error: 'aabaa' was not declared in this scope
   38 |     cout<<aabaa<<endl;
      |           ^~~~~
a.cc:39:11: error: 'aabab' was not declared in this scope
   39 |     cout<<aabab<<endl;
      |           ^~~~~
a.cc:40:11: error: 'aabba' was not declared in this scope
   40 |     cout<<aabba<<endl;
      |           ^~~~~
a.cc:41:11: error: 'aabbb' was not declared in this scope
   41 |     cout<<aabbb<<endl;
      |           ^~~~~
a.cc:42:11: error: 'abaaa' was not declared in this scope
   42 |     cout<<abaaa<<endl;
      |           ^~~~~
a.cc:43:11: error: 'abaab' was not declared in this scope
   43 |     cout<<abaab<<endl;
      |           ^~~~~
a.cc:44:11: error: 'ababa' was not declared in this scope
   44 |     cout<<ababa<<endl;
      |           ^~~~~
a.cc:45:11: error: 'ababb' was not declared in this scope
   45 |     cout<<ababb<<endl;
      |           ^~~~~
a.cc:46:11: error: 'abbaa' was not declared in this scope
   46 |     cout<<abbaa<<endl;
      |           ^~~~~
a.cc:47:11: error: 'abbab' was not declared in this scope
   47 |     cout<<abbab<<endl;
      |           ^~~~~
a.cc:48:11: error: 'abbba' was not declared in this scope
   48 |     cout<<abbba<<endl;
      |           ^~~~~
a.cc:49:11: error: 'abbbb' was not declared in this scope
   49 |     cout<<abbbb<<endl;
      |           ^~~~~
a.cc:52:5: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   52 |     cout<<aaaaaa<<endl;
      |     ^~~~
      |     std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:52:11: error: 'aaaaaa' was not declared in this scope
   52 |     cout<<aaaaaa<<endl;
      |           ^~~~~~
a.cc:52:19: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   52 |     cout<<aaaaaa<<endl;
      |                   ^~~~
      |                   std::endl
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
a.cc:53:11: error: 'aaaaab' was not declared in this scope
   53 |     cout<<aaaaab<<endl;
      |           ^~~~~~
a.cc:54:11: error: 'aaaaba' was not declared in this scope
   54 |     cout<<aaaaba<<endl;
      |           ^~~~~~
a.cc:55:11: error: 'aaaabb' was not declared in this scope
   55 |     cout<<aaaabb<<endl;
      |           ^~~~~~
a.cc:56:11: error: 'aaabaa' was not declared in this scope
   56 |     cout<<aaabaa<<endl;
      |           ^~~~~~
a.cc:57:11: error: 'aaabab' was not declared in this scope
   57 |     cout<<aaabab<<endl;
      |           ^~~~~~
a.cc:58:11: error: 'aaabba' was not declared in this scope
   58 |     cout<<aaabba<<endl;
      |           ^~~~~~
a.cc:59:11: error: 'aaabbb' was not declared in this scope
   59 |     cout<<aaabbb<<endl;
      |           ^~~~~~
a.cc:60:11: error: 'aabaaa' was not declared in this scope
   60 |     cout<<aabaaa<<endl;
      |           ^~~~~~
a.cc:61:11: error: 'aabaab' was not declared in this scope
   61 |     cout<<aabaab<<endl;
      |           ^~~~~~
a.cc:62:11: error: 'aababa' was not declared in this scope
   62 |     cout<<aababa<<endl;
      |           ^~~~~~
a.cc:63:11: error: 'aababb' was not declared in this scope
   63 |     cout<<aababb<<endl;
      |           ^~~~~~
a.cc:64:11: error: 'aabbaa' was not declared in this scope
   64 |     cout<<aabbaa<<endl;
      |           ^~~~~~
a.cc:65:11: error: 'aabbab' was not declared in this scope
   65 |     cout<<aabbab<<endl;
      |           ^~~~~~
a.cc:66:11: error: 'aabbba' was not declared in this scope
   66 |     cout<<aabbba<<endl;
      |           ^~~~~~
a.cc:67:11: error: 'aabbbb' was not declared in this scope
   67 |     cout<<aabbbb<<endl;
      |           ^~~~~~
a.cc:68:11: error: 'abaaaa' was not declared in this scope
   68 |     cout<<abaaaa<<endl;
      |           ^~~~~~
a.cc:69:11: error: 'abaaab' was not declared in this scope
   69 |     cout<<abaaab<<endl;
      |           ^~~~~~
a.cc:70:11: error: 'abaaba' was not declared in this scop