import java.util.HashSet;
import java.util.Vector;

class Block {
	String name = new String();
	String color = new String();
	String shape = new String();

	Block(String initName, String initColor, String initShape) {
		this.name = initName;
		this.color = initColor;
		this.shape = initShape;

	}

	boolean isHave(String element) {
		if (this.name.equals(element) || this.color.equals(element)
				|| this.shape.equals(element)) {
			return true;
		}
		return false;
	}

}

class BlockOp {
	static Vector<Block> list = new Vector<Block>();
	static HashSet<String> elements = new HashSet<String>();

	/**
	 * ブロックの追加
	 * @param initName
	 * @param initColor
	 * @param initShape
	 */
	public void addBlock(String initName, String initColor, String initShape) {
		list.add(new Block(initName, initColor, initShape));
		elements.add(initColor);
		elements.add(initShape);
	}

	/**
	 * nameのブロックの色または形がelementならtrue
	 * @param name
	 * @param element
	 * @return
	 */
	public boolean isHave(String name, String element) {
		System.out.println("isHave");
		return list.elementAt(indexOf(name)).isHave(element);
	}

	/**
	 * nameStrのブロックのindexを返す
	 * @param nameStr
	 * @return
	 */
	public int indexOf(String nameStr) {
		System.out.println("indexOf");
		for (int index = 0; index < list.size(); index++) {
			//System.out.println(index);
			if (nameStr.equals(list.elementAt(index).name)) {
				return index;
			}
		}
		return -1;
	}
}