Fold pre to the 3bet imo, villian is representing a strong hand with a 3bet oop and you are dominated by most hands that would be doing it (TT+, AJss+, AQ+) ... so your basically hoping to flop 2 pair or a miraculous 88x to feel confident with your holdings.
You generally are not happy to see the A on the flop here, granted you can discount some combos since AK is a lower probability (with the flop containing xAK) but you are behind any A9+ so should proceed with caution .... which I believe you did, since difficult to determine the action precisely from screenshots but i think you flat his flop donk bet right?
Why the turn re-raise though, if you believe him to have QQ/JJ type of a hand let him keep firing, your hand is not strong enough to re-raise which means you are bluffing with a hand that has showdown value if the price does not get too high.
So fold pre to the 3b (how much was his reraise too? could certainly make a difference in action), but as played flat turn and reevaluate the river. With a one pair hand only and villian betting strong, unless you have reads that they are a maniac, then you are very likely behind.
Disclaimer: I have been away from poker for a while so could be way off here, and as mentioned a bit difficult to see the true action of the hand from scattered screenshots vs a handhistory.