class Edge {
    final short from;
    final short to;

    public Edge(short from, short to) {
      this.from = from;
      this.to = to;
    }

    @Override
    public int hashCode() {
      return (this.from << 16) + this.to;
    }

    @Override
    public boolean equals(Object other) {
      Edge o = (Edge) other;
      return this.from == o.from && this.to == o.to;
    }
  }

  public boolean areAdjacent(short from, short to) {
    if (from > to) {
      return areAdjacent(to, from);
    }
    if (from < 0 || to < 0) {
      return false;
    }
    if (from == to) {
      return true;
    }
    return edges.contains(new Edge(from, to));
  }

  public void addEdge(short from, short to) {<FILL_FUNCTION_BODY>

    if (from < 0) {
      throw new RuntimeException("from < 0");
    }
    if (to < 0) {
      throw new RuntimeException("to < 0");
    }
    if (from > to) {
      addEdge(to, from);
      return;
    }
    edges.add(new Edge(from, to));
  
<no_super_class>