# Which city is the bus from?

There are four buses; their origins are the cities of A, B, C, and D. their destinations are the cities of E, F, G, and H.

They park in a gasoline station in a line to get fuel. after a while, they start to go to their destinations (not in the order of cities they are from and/or going to, which was mentioned in the first paragraph).

Information (in the gas station):

• the bus that is destined to E is exactly in front of the bus that is originated from A.
• the buses that are destined to F and G, are placed consecutively in the line (the order of these two buses is unknown).
• one of the buses is going from B to H.
• the origin of the first and last buses in the line is one of the cities B and C.

Question: If the last bus is destined to F, then which city is the origin of the bus that is going to E?

The origin is D

Logic:

The last bus is going to F, and G is next to F, so the 3rd bus is going to G

This means the first two buses are going to E and H in some order.

B is going to H and has to be either first or last, so it's first (B -> H).

This means Bus 2 is going to H. All destinations determined.

C must be last, so bus 2 and 3 are A or D in some order.

A is behind the bus going to E, which is 2, so A must be in slot 3.

Order:

B -> H

D-> E

A -> G

C -> F

• I believe you made a typo in the line where you wrote where bus 2 is headed – Danny Harding Aug 10 '20 at 2:37

Some quick logic:

- From the second point and the fact that the bus destined to F is in last place we know that the order is (Front to back) ?, ?, G, F
- The last two points and the point above means the bus from B to H is in first (as it cant be last, as thats going to ), and therefore the bus from C is last. The order is now H, E, G, F and the origins are B, ?, ?, C
- The first points means the origins must be B, D, A, C

So the final orders are

H, E, G, F and B, D, A, C

And therefore the origin of the bus going to E is

D

Actually

the condition that the buses that are destined to F and G, are placed consecutively in the line is redundant (the question can be answered without it)

because

We know that the buses #1 and #4 go from B and C, and the bus #4 goes to F. But the bus from B is going to H (not F), so it must be the bus #1. So, the bus #4 must go from C (to F). Since the bus to E is not going from A (we know that these buses are different), that bus must arrive from D, the only remaining city. Question answered.