Step One. Count hosts on each subnet, and refer back to the chart showing how many addresses can be assigned for each prefix length. Two of the branch offices have 20 hosts (21 including the router), and the other has 25 hosts (26 including the router). Each of these subnets will require a /27 prefix, since these can handle up to 30 addresses. Of the headquarters subnets, the one with 30 hosts will require another /27, the one with 50 hosts will require a /26, and the two 10 host subnets each require a /28.
Don't forget the three WAN links, each requiring a /30, and the Ethernet connecting the two routers together, which also requires a /30. However, since more hosts might later be added to the Ethernet, we'll assign it a /29 for expansion purposes.
Step Two. Assign largest subnets first. The largest subnet is the headquarters subnet with 50 hosts, requiring a /26 prefix. We'll assign to it 188.8.131.52/26, using numbers from 0 to 63 in the fourth byte.
Next we need four /27s (one in the headquarters, and one for each of the branch offices). We'll assign 184.108.40.206/27, 220.127.116.11/27, 18.104.22.168/27, and 22.214.171.124/27. We've now used numbers from 0 to 191 in the fourth byte.
The two /28s will be 126.96.36.199/28 and 188.8.131.52/28. That leaves 184.108.40.206/29 for the Ethernet between the two headquarters routers, and the remaining address space for the three WAN links: 220.127.116.11/30, 18.104.22.168/30 and 22.214.171.124/30.