Estimate confidence intervals for the P value of the Pearson's Chi-squared test [duplicate]

I have a contingency table where I estimate the p value Pearson's Chi-squared test, I want to take a confidence interval to validate this value P some code to do this by simulation monte carlo?

       A   B   C   D
H    3   9  16  13
M   13   8  19  21

Pearson's Chi-squared test
data:  tabla1
X-squared = 4.7077, df = 3, p-value = 0.1945