A certain group company has six departments: production department, sales department, R & D department, personnel department, finance department and legal department. There are six office buildings from front to back: Wu ,Ji, Geng , Xin , Ren  and Gui . Each department has a building, and the arrangement of each department meets the following requirements: (1) the sales department is in front of the finance department and the production department. (2) the personnel department is immediately after the R & D department or the production department; (3) the legal department is followed by the R & D department or the sales department.
The sales department is in the Wu building if the legal department is in the Ren building.