How to populate Account when Contact is selected in WhoId for Task in Salesforce?

Create a Record Triggered Flow to populate Account when Contact is selected in Name(WhoId) while creating Task. 

Sample Flow:


Find Contact from Who Id Salesforce Flow:
Note:
"003" used here is to make sure the Name(WhoId) is contact and not lead.
 
 
Fetch Account Id using Contact Id:


Set What Id of Task to Account Id Salesforce Flow: