Need advice on an automation

I want to have an automation that is related two events (name as e1 and e2)
the action should be triggered when both e1 and e2 happen, but e1 can happen earlier than e2 or vice versa.

I can do it with two automations:
trigger: e1
condition: e2
action:

trigger: e2
condition: e1
action:

Can I have a way to do the same using a single automation?

Yes, you can list multiple triggers and conditions.

trigger: 
  - e1
  - e2
condition: 
  - e1
  - e2
action: