#include <bits/stdc++.h>   using namespace std;   const int OO = 0x3f3f3f3f, N = 1e5 + 5, mod = 1e9 + 7;   const double pi = acos(-1), EPS = 1e-8;   int n;   string str;   map<deque<char>, deque<char>> mp;   bool is(deque<char> ck, string s) {     if (ck.size() != s.size()) return 0;     for (int i = 0; i < s.size(); ++i)       if (ck[i] != s[i]) return 0;     return 1;   }   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     deque<char> t;     t.push_back( v );     t.push_back( o );     t.push_back( i );     t.push_back( d );     mp[t] = t;     cin >> n;     cin.ignore();     while (n--) {       getline(cin, str);       bool out = 0;       deque<char> tmp, s;       for (int i = 0; i < str.size(); ++i) {         if (str[i] ==    ) {           if (tmp.size()) {             if (is(tmp,  typeof ))               out = 1;             else               s = tmp;           }           tmp.clear();         } else           tmp.push_back(str[i]);       }       deque<char> var = tmp;       if (out) {         int And = 0, pointer = 0;         while (var.front() ==  & ) ++And, var.pop_front();         while (var.back() ==  * ) ++pointer, var.pop_back();         if (mp[var].size() == 0) {           cout <<  errtype n ;           continue;         }         var = mp[var];         while (var.back() ==  * ) ++pointer, var.pop_back();         int x = min(And, pointer);         And -= x;         pointer -= x;         if (And)           cout <<  errtype n ;         else if (mp[var].size()) {           for (char go : mp[var]) cout << go;           while (pointer--) cout <<  * ;           cout <<   n ;         } else           cout <<  errtype n ;       } else {         int And = 0, pointer = 0;         while (s.front() ==  & ) {           ++And;           s.pop_front();         }         while (s.back() ==  * ) {           ++pointer;           s.pop_back();         }         int x = min(And, pointer);         pointer -= x;         And -= x;         if (mp[s].size()) {           s = mp[s];           while (s.back() ==  *  && And) {             --And;             s.pop_back();           }           while (s.front() ==  &  && pointer) {             --pointer;             s.pop_front();           }           if (And && mp[var].size())             mp.erase(var);           else if (And == 0) {             while (pointer--) s.push_back( * );             mp[var] = s;           }         } else if (mp[var].size())           mp.erase(var);       }     }     return 0;   }   