On the Subject of Memory
JavaScript (ES6),  109 106 105  104 bytes
Takes input as a list of pairs [display, &quot;buttons&quot;]. Returns a list of pressed buttons.

a=&gt;a.map(([d,b],i)=&gt;a[i]=b[a[~i]=(n='_5567.848106.80990132'[i*4+d])&gt;3?n&gt;7?a[7-n]:n-4:b.search(a[n]||4)])

Try it online!
How?
The action for each line and each displayed value is encoded as a single character as follows (with 0-indexed lines and positions):

\$n=0\$ to \$3\$: press the button with the same label that we pressed in line \$n\$
\$n=4\$ to \$7\$: press the button in position \$n-4\$
\$n=8\$ or \$9\$: press the button in the same position as we pressed in line \$n-8\$
&quot;.&quot;: press the button labeled &quot;\$4\$&quot;

Translating the rules described in the challenge into these codes leads to the groups 5567, .848, 106., 8099 and 0132, which are concatenated into a single lookup string. The purpose of the leading &quot;_&quot; is just to deal with the 1-indexed input.
The input array \$a[\:]\$ is re-used to store both the labels that are pressed and their positions. For each line \$i\$, we store the label in \$a[i]\$ and its position in \$a[-i-1]\$.
Commented
a =&gt;                              // a[] = input
  a.map(([d, b],                  // for each pair of displayed value d and buttons b
                 i) =&gt;            // at position i in a[]:
    a[i] = b[                     //   save the label in a[i]
      a[~i] =                     //     save its position in a[-i-1]
        ( n =                     //       n = action code taken from ...
          '_5567.848106.80990132' //           ... our lookup string ...
          [i * 4 + d]             //           ... at position i * 4 + d
        ) &gt; 3 ?                   //       if n is greater than 3:
          n &gt; 7 ?                 //         if n is greater than 7:
            a[7 - n]              //           re-use the position used at line n - 8,
                                  //           stored in a[-(n-8)-1], i.e. a[7-n]
          :                       //         else:
            n - 4                 //           use the position n - 4
        :                         //       else:
          b.search(a[n]           //         look for the label used at line n
                        || 4)     //         or look for '4' if a[n] is undefined,
                                  //         which happens only when n is '.'
    ]                             //   end of button lookup
  )                               // end of map()