Parent and child categories

Have a look at get_the_terms()?

<?php 
    // Change 'category' if using a custom taxonomy and not referring to the default blog categories
    $terms = get_the_terms( $post->ID, 'category' ); 
?>

<tr>
  <td><?php

    foreach($terms as $term) {

      // show which categorie(s) under ABC
      if( $term->parent == '0' ) ) {
        echo $term->name;
      } 

    }
  ?></td> 

  <td><?php

    foreach($terms as $term) {

      // show which categorie(s) under 12
      if( $term->parent == '1' ) ) {
        echo $term->name;
      }

    }
?></td>
</tr>