comefrom: <awangdev>Redundant Connection_2.java
code: public int[] findRedundantConnection(int[][] edges) {
          Map<Integer, Set<Integer>> graph = new HashMap<>();
          
          for (int[] edge : edges) {
              int x = edge[0], y = edge[1];
              Set<Integer> visited = new HashSet<>();
              Queue<Integer> queue = new LinkedList<>();
              queue.offer(x);
              
              while (!queue.isEmpty()) {
                  int node = queue.poll();
                  if (!graph.containsKey(node)) continue;
                  if (graph.get(node).contains(y)) return edge;
                  for (int num : graph.get(node)) {
                      if (visited.contains(num)) continue;
                      queue.offer(num);
                      visited.add(num);
                  }
              }
  
              graph.putIfAbsent(x, new HashSet<>());
              graph.putIfAbsent(y, new HashSet<>());
              graph.get(x).add(y);
              graph.get(y).add(x);
          }
          
          return new int[] {-1, -1};
      }
masked: public int [ ] sample_funcname ( int [ ] [ ] var_0 ) {
    Map < Integer , Set < Integer >> var_5 = new HashMap < > ( ) ;
    for ( int [ ] var_6 : var_0 ) {
      int var_8 = var_6 [ 0 ] , var_10 = var_6 [ 1 ] ;
      Set < Integer > var_12 = new HashSet < > ( ) ;
      Queue < Integer > var_15 = new LinkedList < > ( ) ;
      var_15 . offer ( var_8 ) ;
      while ( ! var_15 . isEmpty ( ) ) {
        int var_19 = var_15 . poll ( ) ;
        if ( ! var_5 . containsKey ( var_19 ) ) continue ;
        if ( var_5 . get ( var_19 ) . contains ( var_10 ) ) return var_6 ;
        for ( int var_23 : var_5 . get ( var_19 ) ) {
          if ( var_12 . contains ( var_23 ) ) continue ;
          var_15 . offer ( var_23 ) ;
          var_12 . add ( var_23 ) ;
        }
      }
      var_5 . putIfAbsent ( var_8 , new HashSet < > ( ) ) ;
      var_5 . putIfAbsent ( var_10 , new HashSet < > ( ) ) ;
      var_5 . get ( var_8 ) . add ( var_10 ) ;
      var_5 . get ( var_10 ) . add ( var_8 ) ;
    }
    return new int [ ] {
      - 1 , - 1 };
    }
    