import java.io.File;
import java.util.Scanner;

class ContainerApp {
	public static void main(String [] args) throws Exception {
		Scanner scanner = new Scanner(new File("container_actions.text"));

		Container container = new Container();

		while (scanner.hasNext()) {
			String action = scanner.next();
			int value;
			int index;

			switch (action) {
				case "A":
					value = scanner.nextInt();
					container.add(value); 
					System.out.print("After adding " + value + ": " + container);
					break;

				case "F":
					value = scanner.nextInt();
					int pos = container.find(value);
					if (pos >= 0) 
						System.out.println(value + " is at position " + pos + " of the container");
					else
						System.out.println(value + " is not in the container");
					break;

				case "G":
					index = scanner.nextInt();
					value = container.get(index);
					System.out.println("The value at location " + index + " is " + value);
					break;

				default:
					System.out.println("*** Error *** unknown action: " + action);
			}
		}
	}	
}
