Sophia’s school took a field trip. A total of 21 vehicles were needed for the trip. Some students the bus, and some students car-pooled. There were 30 people on each bus and 4 people in each car. 318 people altogether attended the trip. How many buses and cars were needed for the trip?