import java.util.*;

class Node {
    String name; 
    Vector connections = new Vector(); 
    boolean visited = false; 

    Node(String name) {
	this.name = name; 
    }

    public void add(Connection c) {
	connections.add(c); 
    }

    public Vector search(Node to) {
	if (this == to)
	    return new Vector();
	if (visited)
	    return null; 
	else {
	    visited = true; 
	    for(int i = 0; i < connections.size(); i++) {
		Node neighbor = ((Connection)connections.elementAt(i)).n;
		Vector tmp = neighbor.search(to); 
		if (null != tmp) {
		    tmp.add(0,this.name); 
		    return tmp;
		}
	    }
	    return null; 
	}
    }
}
