Same logic as @Black Cat, just find the first entry less than 50:
=BYROW(B2:G7,LAMBDA(r,XMATCH(TRUE,HSTACK(r,0)<50)-1))