Here another alternative, using @VBasic2008's sample data:
=BYROW(E2:E11,LAMBDA(x,IFERROR(@TOCOL(IF(A2:C4=x,A1:C1,NA()),2),"Not Found")))
Here is the output:

@
-operator is used in case of duplicated values. In that case, it returns the first column header value found. IFERROR
is used just in case the value was not found. TOCOL
function is very efficient, so it would be suitable for a large dataset too.
If you want to return all the headers in case of duplicated values, then use the following:
=BYROW(E2:E11,LAMBDA(x,
IFERROR(TEXTJOIN(", ",,TOCOL(IF(A2:C4=x,A1:C1,NA()),2)),"Not Found")))
In case of non-duplicated values, the follow works too:
=BYROW(E2:E11,LAMBDA(x,LET(z,CONCAT(IF(A2:C4=x,A1:C1,"")),
IF(z="","Not Found",z))))
The IF
condition is added to treat the case of not found. Similar idea used by @MayukhBhattacharya. If you don't want to handle this case, it results in a shorter approach:
=BYROW(E2:E11,LAMBDA(x,CONCAT(IF(A2:C4=x,A1:C1,""))))