content: class Solution {
      public List<List<Integer>> findWinners(int[][] matches) {
          Set<Integer> zeroLoss = new HashSet<>(), oneLoss = new HashSet<>(),
                  moreLosses = new HashSet<>();
  
          for (int[] match : matches) {
              int winner = match[0], loser = match[1];
              // Add winner.
              if (!oneLoss.contains(winner) && !moreLosses.contains(winner)) {
                  zeroLoss.add(winner);
              }
              // Add or move loser.
              if (zeroLoss.contains(loser)) {
                  zeroLoss.remove(loser);
                  oneLoss.add(loser);
              } else if (oneLoss.contains(loser)) {
                  oneLoss.remove(loser);
                  moreLosses.add(loser);
              } else if (moreLosses.contains(loser)) {
                  continue;
              } else {
                  oneLoss.add(loser);
              }
          }
  
          List<List<Integer>> answer =
              Arrays.asList(new ArrayList<>(), new ArrayList<>());
          answer.get(0).addAll(zeroLoss);
          answer.get(1).addAll(oneLoss);
          Collections.sort(answer.get(0));
          Collections.sort(answer.get(1));
  
          return answer;
      }
  }