Language: C++

#include<iostream>
#include<cstdio>
#include<string>
#include<vector>
#include<map>
using namespace std;

string query(pair<string,string> p1,pair<string,string> p2){
  string s1,s2;
  s1 = p1.first + p2.first;
  s2 = p1.second + p2.second;
  printf("%s\n%s\n", s1.c_str(), s2.c_str()); fflush(stdout);
  string str;
  cin >> str;
  return str;
}

int main(){
  int N;
  cin >> N;

  vector<vector<pair<string,string> > >vec;
  for(int i = 0 ; i < 2 ; i++){
    string str1;
    string str2;
    for(int j = 0 ; j < 4 ; j++){
      str1 += (j%2?".":"#");
      str2 += ((j >> 1)%2?".":"#");
    }
    vector<pair<string,string> > v;
    v.push_back(make_pair(str1,str2));
    vec.push_back(v);
  }
  
  while(1){
    for(int i = 0 ; i < vec.size() ; i++){
      for(int j = i ; j < vec.size() ; j++){
	for(int k = 0 ; k < 2 ; k++){
	  string r;
	  pair<string,string>p;
	  if(k % 2){
	    r = query(vec[i],vec[j]);
	    p = make_pair(vec[i].first + vec[j].first,vec[i].second + vec[j].second);
	  }
	  else {
	    r = query(vec[j],vec[i]);
	    p = make_pair(vec[j].first + vec[i].first,vec[j].second + vec[i].second);
	  }
	  // in
	  if(r == "T"){
	    vec.push_back(p);
	  }
	  else if(r == "end"){
	    return 0;
	  }
	}
      }
    }
  }
return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:42:22: error: could not convert 'vec.std::vector<std::vector<std::pair<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> > > >::operator[](((std::vector<std::vector<std::pair<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> > > >::size_type)i))' from '__gnu_cxx::__alloc_traits<std::allocator<std::vector<std::pair<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> > > >, std::vector<std::pair<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> > > >::value_type' {aka 'std::vector<std::pair<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> > >'} to 'std::pair<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> >'
   42 |             r = query(vec[i],vec[j]);
      |                 ~~~~~^~~~~~~~~~~~~~~
      |                      |
      |                      __gnu_cxx::__alloc_traits<std::allocator<std::vector<std::pair<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> > > >, std::vector<std::pair<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> > > >::value_type {aka std::vector<std::pair<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> > >}
a.cc:43:34: error: '__gnu_cxx::__alloc_traits<std::allocator<std::vector<std::pair<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> > > >, std::vector<std::pair<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> > > >::value_type' {aka 'class std::vector<std::pair<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> > >'} has no member named 'first'
   43 |             p = make_pair(vec[i].first + vec[j].first,vec[i].second + vec[j].second);
      |                                  ^~~~~
a.cc:43:49: error: '__gnu_cxx::__alloc_traits<std::allocator<std::vector<std::pair<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> > > >, std::vector<std::pair<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> > > >::value_type' {aka 'class std::vector<std::pair<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> > >'} has no member named 'first'
   43 |             p = make_pair(vec[i].first + vec[j].first,vec[i].second + vec[j].second);
      |                                                 ^~~~~
a.cc:43:62: error: '__gnu_cxx::__alloc_traits<std::allocator<std::vector<std::pair<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> > > >, std::vector<std::pair<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> > > >::value_type' {aka 'class std::vector<std::pair<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> > >'} has no member named 'second'
   43 |             p = make_pair(vec[i].first + vec[j].first,vec[i].second + vec[j].second);
      |                                                              ^~~~~~
a.cc:43:78: error: '__gnu_cxx::__alloc_traits<std::allocator<std::vector<std::pair<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> > > >, std::vector<std::pair<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> > > >::value_type' {aka 'class std::vector<std::pair<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> > >'} has no member named 'second'
   43 |             p = make_pair(vec[i].first + vec[j].first,vec[i].second + vec[j].second);
      |                                                                              ^~~~~~
a.cc:46:22: error: could not convert 'vec.std::vector<std::vector<std::pair<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> > > >::operator[](((std::vector<std::vector<std::pair<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> > > >::size_type)j))' from '__gnu_cxx::__alloc_traits<std::allocator<std::vector<std::pair<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> > > >, std::vector<std::pair<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> > > >::value_type' {aka 'std::vector<std::pair<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> > >'} to 'std::pair<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> >'
   46 |             r = query(vec[j],vec[i]);
      |                 ~~~~~^~~~~~~~~~~~~~~
      |                      |
      |                      __gnu_cxx::__alloc_traits<std::allocator<std::vector<std::pair<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> > > >, std::vector<std::pair<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> > > >::value_type {aka std::vector<std::pair<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> > >}
a.cc:47:34: error: '__gnu_cxx::__alloc_traits<std::allocator<std::vector<std::pair<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> > > >, std::vector<std::pair<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> > > >::value_type' {aka 'class std::vector<std::pair<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> > >'} has no member named 'first'
   47 |             p = make_pair(vec[j].first + vec[i].first,vec[j].second + vec[i].second);
      |                                  ^~~~~
a.cc:47:49: error: '__gnu_cxx::__alloc_traits<std::allocator<std::vector<std::pair<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> > > >, std::vector<std::pair<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> > > >::value_type' {aka 'class std::vector<std::pair<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> > >'} has no member named 'first'
   47 |             p = make_pair(vec[j].first + vec[i].first,vec[j].second + vec[i].second);
      |                                                 ^~~~~
a.cc:47:62: error: '__gnu_cxx::__alloc_traits<std::allocator<std::vector<std::pair<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> > > >, std::vector<std::pair<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> > > >::value_type' {aka 'class std::vector<std::pair<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> > >'} has no member named 'second'
   47 |             p = make_pair(vec[j].first + vec[i].first,vec[j].second + vec[i].second);
      |                                                              ^~~~~~
a.cc:47:78: error: '__gnu_cxx::__alloc_traits<std::allocator<std::vector<std::pair<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> > > >, std::vector<std::pair<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> > > >::value_type' {aka 'class std::vector<std::pair<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> > >'} has no member named 'second'
   47 |             p = make_pair(vec[j].first + vec[i].first,vec[j].second + vec[i].second);
      |                                                                              ^~~~~~
a.cc:51:26: error: no matching function for call to 'std::vector<std::vector<std::pair<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> > > >::push_back(std::pair<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> >&)'
   51 |             vec.push_back(p);
      |             ~~~~~~~~~~~~~^~~
In file included from /usr/include/c++/14/vector:66,
                 from a.cc:4:
/usr/include/c++/14/bits/stl_vector.h:1283:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = std::vector<std::pair<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> > >; _Alloc = std::allocator<std::vector<std::pair<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> > > >; value_type = std::vector<std::pair<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> > >]'
 1283 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1283:35: note:   no known conversion for argument 1 from 'std::pair<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> >' to 'const std::vector<std::vector<std::pair<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> > > >::value_type&' {aka 'const std::vector<std::pair<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> > >&'}
 1283 |       push_back(const value_type& __x)
      |                 ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:1300:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = std::vector<std::pair<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> > >; _Alloc = std::allocator<std::vector<std::pair<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> > > >; value_type = std::vector<std::pair<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> > >]'
 1300 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1300:30: note:   no known conversion for argument 1 from 'std::pair<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> >' to 'std::vector<std::vector<std::pair<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> > > >::value_type&&' {aka 'std::vector<std::pair<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> > >&&'}
 1300 |       push_back(value_type&& __x)
      |                 ~~~~~~~~~~~~~^~~