How do I create a dummy variable which takes the value 1 in a household when first two children are female otherwise 0?

I have the following dataset
HHiD birth order gender
1 1 male(1)
1 2 female(2)
1 3 1
2 1 2
2 2 2
2 3 1