Help needed regarding first 3 items in the list

Hi,
I've a list in the following format:

Empdept filedetails buildingNo Area
AAA 444 2 juy
AAA 544 2 kui
AAA 567 4 poi
AAA 734 5 oiu
AAA 444 2 juy
AAB 594 2 kui
AAB 507 4 poi
AAB 764 5 oiu
AAB 444 2 juy
AAB 544 2 kui
AAB 567 4 poi
AAB 734 5 oiu
AAC 444 2 juy
AAC 544 2 kui
AAC 567 4 poi
AAC 734 5 oiu
AAC 444 2 juy
AAC 544 2 kui
AAC 567 4 poi
AAD 734 5 oiu

now this list might grow and I might have 50 AAA empdepts , 40 AAB depts and 40 AAC empdepts and so on...

Now I want to have a script which will pick only 3 (or upto 3) Empdept details from this list.. like

Empdept filedetails buildingNo Area
AAA 444 2 juy
AAA 544 2 kui
AAA 567 4 poi

AAB 594 2 kui
AAB 507 4 poi
AAB 764 5 oiu

AAC 444 2 juy
AAC 544 2 kui
AAC 567 4 poi

AAD 734 5 oiu

Please help me with a shell script which will do this very quickly...

Thanks in advance...

$ awk 'A[$1]++ < 3' file1 
AAA 444 2 juy
AAA 544 2 kui
AAA 567 4 poi
AAB 594 2 kui
AAB 507 4 poi
AAB 764 5 oiu
AAC 444 2 juy
AAC 544 2 kui
AAC 567 4 poi
AAD 734 5 oiu

$ awk '{print $1}' infile | uniq | while read line; do
grep -m3 "^$line" infile && echo
done