All perfect praise be to Allaah, The Lord of the Worlds. I testify that there is none worthy of worship except Allaah, and that Muhammad is His slave and Messenger.
The blood that you saw the second time on the 30th of August is bleeding outside your monthly period because this blood is not menses as there is less than 15 days between it and (the end of) your previous menses, and the minimum period of purity between two menses is 15 days. Also, this blood cannot be added to the first menses so that it can be considered as one menses because its total number of days exceeds 15 days which is the maximum time-period of menses.
Since this bleeding is a bleeding outside the monthly menses as we mentioned, then your fasting during that period is valid, and you were obliged to do what a woman who has blood discharges outside her monthly menses is obliged to do, like performing ablution for every prayer after the time of the prayer has begun, and putting a pad on your private parts and then you pray with this ablution the obligatory prayer along with any supererogatory prayers you wish, and all the rules of women who are in a state of purity apply to you.
As regards the bleeding that you saw the third time, then if it was during the days of your regular menses, it is menses, because a woman who has bleeding outside her monthly menses should consider her monthly period if she has a known monthly period, and the bleeding that she has outside the monthly period is not menses.
If you have no regular menses, then you should distinguish between the types of blood that you have; the blood that has the characteristics of the blood of menses, like having black color, being thick and having a smell, and having pain when you have these blood discharges, then it is menses. However, if this blood has the characteristics of the blood outside the monthly menses, like its bright red color, being light and the like, then it is bleeding outside the monthly menses.
If you have no monthly menses and your bleeding is not distinguishable, then you should refrain from the prayer and fasting for the regular period of the women of your family, like 6 days or 7 days and what is beyond this is considered bleeding outside your monthly menses.
Allaah Knows best.