import java.util.*;

public class banking
{
	public static void main(String[] args)
	{
		Scanner sc = new Scanner(System.in);
		int pocetUctu;
		pocetUctu = sc.nextInt();
		double[][] ucty = new double[100][100001];
		while (pocetUctu != 0)
		{
			sc.nextLine();
			for (int i = 0; i < 100; i++)
			{
				for (int j = 0; j < 100001; j++)
				{
					ucty[i][j] = -1;
				}
			}
			String[] acc;
			for (int i = 0; i < pocetUctu; i++)
			{
				String s = sc.nextLine();
				acc = s.split(" ");
				String[] u = acc[0].split("/");
				int l = Integer.parseInt(u[0]);
				int k = Integer.parseInt(u[1]);
				ucty[k][l] = Double.parseDouble(acc[1]);
			}
			String prikaz = sc.nextLine();
			while (true)
			{
				String[] pr = prikaz.split(" ");
				if (pr[0].equals("create"))
				{
					String[] name = pr[1].split("/");
					int l = Integer.parseInt(name[0]);
					int k = Integer.parseInt(name[1]);
					if (ucty[k][l] != -1)
					{
						System.out.println("create: already exists");
					}
					else
					{
						ucty[k][l] = 0;
						System.out.println("create: ok");						
					}
				}
				else if (pr[0].equals("deposit"))
				{
					String[] name = pr[1].split("/");
					int l = Integer.parseInt(name[0]);
					int k = Integer.parseInt(name[1]);
					if (ucty[k][l] != -1)
					{
						double val = Double.parseDouble(pr[2]);
						ucty[k][l] += val;
						System.out.println("deposit " + pr[2] + ": ok");
					}
					else
					{
						System.out.println("deposit " + pr[2] + ": no such account");
					}
				}
				else if (pr[0].equals("withdraw"))
				{
					String[] name = pr[1].split("/");
					int l = Integer.parseInt(name[0]);
					int k = Integer.parseInt(name[1]);
					if (ucty[k][l] != -1)
					{
						double val = Double.parseDouble(pr[2]);
						if (ucty[k][l] < val)
						{
							System.out.println("withdraw " + pr[2] + ": insufficient funds");
						}
						else
						{
							ucty[k][l] -= val;
							System.out.println("withdraw " + pr[2] + ": ok");
						}
					}
					else
					{
						System.out.println("withdraw " + pr[2] + ": no such account");
					}
				}
				else if (pr[0].equals("transfer"))
				{
					String[] name = pr[1].split("/");
					int l = Integer.parseInt(name[0]);
					int k = Integer.parseInt(name[1]);
					name = pr[2].split("/");
					int dl = Integer.parseInt(name[0]);
					int dk = Integer.parseInt(name[1]);
					if (ucty[k][l] == -1 || ucty[dk][dl] == -1)
					{
						System.out.println("transfer " + pr[3] + ": no such account");
					}
					else if (l == dl && k == dk)
					{
						System.out.println("transfer " + pr[3] + ": same account");
					}
					else 
					{
						double val = Double.parseDouble(pr[3]);
						if (val > ucty[k][l])
						{
							System.out.println("transfer " + pr[3] + ": insufficient funds");
						}
						else
						{
							ucty[k][l] -= val;
							ucty[dk][dl] += val;
							if (dk == k)
							{
								System.out.println("transfer " + pr[3] + ": ok");
							}
							else
							{
								System.out.println("transfer " + pr[3] + ": interbank");
							}
						}
					}
				}
				else if (prikaz.equals("end"))
				{
					System.out.println("end");
					System.out.println();
					break;
				}
				prikaz = sc.nextLine();
			}
			pocetUctu = sc.nextInt();
		}
		System.out.println("goodbye");
	}
}