public char getColor(int p, char[][] graph) {
      switch (p) {
      case 0: return graph[b][c];
      case 1: return graph[a][c];
      case 2: return graph[a][b];
      }
      throw new IllegalArgumentException("Invalid piece");
    }