A farmer has two types of apples. He harvested 120 apples of type A and 80 apples of type B. The farmer wants to pack the apples into boxes such that each box contains the same number of apples.
What is the greatest number of boxes he can pack while ensuring each box contains only apples of one type and the number of apples per box is the same for all boxes?