Calculate a Pedigree
05AB1E, 39 bytes
εNUε'aåi„aaë¯.øX&lt;X&gt;‚è˜y2£lSδåPài„Aaë„A_

Port of my Java answer.
Try it online or verify all test cases.
Explanation:

ε                     # Map over the rows of the (implicit) input-list:
 NU                   #  Store the outer-map index in variable `X`
   ε                  #  Map over the strings `y` of the current row:
    'aåi             '#   If the current string contains an &quot;a&quot;:
        „aa           #    Push string &quot;aa&quot;
       ë              #   Else (it contains an &quot;A&quot; instead):
        ¯.ø           #    Surround the (implicit) input-list with two empty lists
                      #    (05AB1E has automatic wrap-around when indexing lists,
                      #     so this is to prevent that)
           X&lt;X&gt;‚      #    Push `X-1` and `X+1` and pair them together
                è     #    Index both into the list to get (potential) parent and child rows
                 ˜    #    Flatten it to a single list
        y             #    Push the current string we're mapping again
         2£           #    Only leave the first 2 characters (its id and the letter &quot;A&quot;)
           l          #    Lowercase the &quot;A&quot; to &quot;a&quot;
            S         #    And convert it to a list of characters: [id, &quot;A&quot;]
             δå       #    Check in each string whether it contains the id and &quot;A&quot;
               P      #    Check for each whether it contained BOTH the id AND &quot;A&quot;
                ài    #    If a child/parent is found for which this is truthy:
                  „Aa #     Push string &quot;Aa&quot;
                 ë    #    Else:
                  „A_ #     Push string &quot;A_&quot;
                      # (after which the mapped result is output implicitly)