#include <bits/stdc++.h>   using namespace std;   string op, s1, s2;   map<string, int> mp;   int solve(string s) {     int ast, amp;     ast = count(s.begin(), s.end(),  * );     amp = count(s.begin(), s.end(),  & );     return ast - amp;   }   string remove(string s) {     s.erase(remove(s.begin(), s.end(),  * ), s.end());     s.erase(remove(s.begin(), s.end(),  & ), s.end());     return s;   }   int main() {     int N;     cin >> N;     mp[ void ] = 0;     while (N--) {       cin >> op;       if (op ==  typedef ) {         cin >> s1 >> s2;         int d = solve(s1);         s1 = remove(s1);         if (mp.find(s1) != mp.end() && mp[s1] >= 0)           mp[s2] = mp[s1] + d;         else           mp[s2] = -1;       } else {         cin >> s1;         int d = solve(s1);         s1 = remove(s1);         if (mp.find(s1) != mp.end() && mp[s1] >= 0) {           d += mp[s1];           if (d >= 0) {             cout <<  void ;             for (int i = 0; i < d; i++) cout <<  * ;             cout << endl;           } else             cout <<  errtype  << endl;         } else           cout <<  errtype  << endl;       }     }     return 0;   }   