The input consists of one or more projects. Each project consists of one or
more rules followed by one command line. A rule is a line of the form
"A<-B...Z.", which means that module A depends on modules B,...,Z.
There may be zero or more module names on the right-hand side of "<-".
Module names are single lowercase letters. There will be exactly one rule for
every module in the project, and they may appear in any order.
There will be no circular dependencies.
The command line consists of make commands "!" and module names. The commands are processed sequentially from left to right. When a make command appears, output a line containing the modules that must be recompiled, in the order that they must be recompiled, according to the following rule: if A depends on B, then B must be compiled before A. Note that in general the compilation order is not unique.
When a module name appears in the command line it means that the module has been changed and must be recompiled. Before the first make command, all modules must be recompiled. Immediately after a make command, no modules need to be recompiled.
The output must be formatted exactly as shown below. Project numbers are consecutive and begin with 1.
Input must be read from the file "prob9.in", and output must be
written to the file "prob9.out". All output to the screen will be
ignored.
<BOF> e<-. f<-. b<-ef. g<-. c<-gf. d<-. a<-bcd. i<-. h<-id. j<-ah. !f!i! <EOF>
PROJECT #1 efgbcdiahj fbcaj ihj