here we split the pot based on Five hand rule.
community cards are QQ995 P1-A3 , P2-AJ
arrange the cards based on rule P1-QQ99A and P2-QQ99A
so both players be the winner...in Two pair we need to check only 1 kicker card.
I'm assuming this is Texas Hold'em. In Texas Hold'em, you play the best 5-card hand you can, regardless of whether those cards come from your hole cards or the community (board) cards. That means a player could make a hand with any of these combinations:
3 community cards + 2 hole cards
4 community cards + 1 hole card
5 community cards + no hole cards