Back
Close

Master of Mayhem

Statement

 Goal

The Master of Mayhem has unleashed a crew of cyborgs on the city, and may be disguised as one - but which one?

From surveillance reports we have determined that each cyborg is wearing a
hat and some neckwear, and has a companion and a catchphrase.

If Mayhem's hat is a FEDORA, then a cyborg wearing a BEANIE hat can't be the disguise.
If you can eliminate all but one cyborg, that's Mayhem!

Mayhem has only been heard to utter one word from a catchphrase.

We might not know all the attributes of either Mayhem or the cyborgs.

Information about Mayhem and the cyborgs always follows one of these formats:

Name's attribute is a string
Name's attribute is an string
Name's attribute is "string"

A string contains only letters and spaces.
Input
Line 1: An integer N for the number of cyborgs
Next N lines: Cyborg names
Next line: An integer M for the number of reports about Mayhem
Next M lines: Reports about Mayhem in random order
Next line: An integer C for the number of reports about the cyborgs
Next C lines: Reports about the cyborgs in random order
Output
Line 1: The name of the only cyborg that could be Mayhem in disguise.
If none of the listed cyborgs could be Mayhem, output MISSING
If more than one cyborg could be Mayhem, output INDETERMINATE
Constraints
1 <= N <= 10
0 <= M <= 4
0 <= C <= 40
Example
Input
2
SPEEDO
TYPO
3
Mayhem's hat is a FEDORA
Mayhem's neckwear is a STRING OF PEARLS
Mayhem's word is "SNARK"
7
SPEEDO's hat is a FEDORA
TYPO's catchphrase is "I am HUNTING for a SNARK"
TYPO's companion is a MINIATURE DRAGON
SPEEDO's neckwear is a STRING OF PEARLS
SPEEDO's companion is a BEAVER
TYPO's hat is a FEDORA
TYPO's neckwear is a PENDANT
Output
SPEEDO

Tags
StringsLogic

Difficulty
Easy

Test cases
Simple Test
Input
2 SPEEDO TYPO 3 Mayhem's hat is a FEDORA Mayhem's neckwear is a STRING OF PEARLS Mayhem's word is "SNARK" 7 SPEEDO's hat is a FEDORA TYPO's catchphrase is "I am HUNTING for a SNARK" TYPO's companion is a MINIATURE DRAGON SPEEDO's neckwear is a STRING OF PEARLS SPEEDO's companion is a BEAVER TYPO's hat is a FEDORA TYPO's neckwear is a PENDANT
Output
SPEEDO

Simple Validator
Input
2 TRIO OSOLEMIO 3 Mayhem's hat is a STETSON Mayhem's neckwear is a BOW TIE Mayhem's word is "CAUSE" 7 TRIO's hat is a STETSON OSOLEMIO's catchphrase is "I am HUNTING for a CAUSE" OSOLEMIO's companion is a GIGANTIC TARDIGRADE TRIO's neckwear is a BOW TIE TRIO's companion is a MOOSE OSOLEMIO's hat is a STETSON OSOLEMIO's neckwear is a FUR BOUGHT AND PAID FOR
Output
TRIO

No Info Test
Input
3 GROUCHO HARPO CHICO 2 Mayhem's hat is a TYROLEAN ALPINE Mayhem's companion is a HONEY BADGER 6 GROUCHO's neckwear is an INT OF PEARLS HARPO's catchphrase is "You will not CATCH me SLEEPING" GROUCHO's companion is a RAVEN GROUCHO's hat is a TYROLEAN ALPINE HARPO's hat is a BERET HARPO's neckwear is a FEATHER BOA
Output
CHICO

No Info Validator
Input
3 YOHOYOHO READYSETGO VICTORHUGO 2 Mayhem's hat is a BASEBALL CAP Mayhem's companion is a POLITE RHINOCEROS 6 YOHOYOHO's neckwear is an SILK SCARF READYSETGO's catchphrase is "You never SEE me DOZING" YOHOYOHO's companion is a COLLEGIATE DICTIONARY YOHOYOHO's hat is a BASEBALL CAP READYSETGO's hat is a CLOCHE READYSETGO's neckwear is a MILLSTONE
Output
VICTORHUGO

Too Many Cooks Test
Input
6 SPEEDO DITTO ERGO TYPO UHOH OHNO 1 Mayhem's word is "DOUBLE" 20 UHOH's catchphrase is "DOUBLE TROUBLE" TYPO's catchphrase is "I DOUBLE DARE you" OHNO's neckwear is a PAISLEY SHAWL TYPO's companion is a BOWL OF PEANUTS UHOH's neckwear is a DOG COLLAR TYPO's hat is a STRAW BOATER OHNO's catchphrase is "I will make your TROUBLE DOUBLE" OHNO's companion is a PANTS WEARING PANGOLIN DITTO's hat is a GINGHAM BONNET TYPO's neckwear is a LACE RUFF DITTO's neckwear is a CRAVAT ERGO's companion is a CUBE SPEEDO's catchphrase is "You BETTER BOOK it" ERGO's catchphrase is "FIGHT me if you DARE" UHOH's companion is a PARASITIC DRAGON ERGO's hat is a PROPELLER BEANIE SPEEDO's hat is a GOLD CROWN SPEEDO's companion is a UNICORN SPEEDO's neckwear is a WALL CLOCK OHNO's hat is a ROASTED TURKEY
Output
INDETERMINATE

Too Many Cooks Validator
Input
6 KILO MICRO PICO NANO FEMTO YOCTO 1 Mayhem's word is "TRIPLE" 20 PICO's catchphrase is "COME at me if you DARE" FEMTO's companion is a HERNIATED DISK YOCTO's companion is a NONDESCRIPT GRASSHOPPER NANO's catchphrase is "I TRIPLE DARE you" NANO's neckwear is a CONE COLLAR YOCTO's catchphrase is "I will make your TROUBLE TRIPLE" PICO's companion is a RABID RACCOON YOCTO's hat is a GREEN SUN VISOR MICRO's neckwear is a MACARONI NECKLACE YOCTO's neckwear is a FLORAL LEI KILO's neckwear is a SPIDERWEB NANO's hat is a TOQUE BLANCHE KILO's catchphrase is "You OUGHTA BOOK it" KILO's hat is a SOUP TUREEN KILO's companion is a NARHWAL FEMTO's neckwear is a STRING OF SAUSAGES NANO's companion is a PLATE OF JELLO MICRO's hat is a YARMULKE PICO's hat is a BALACLAVA FEMTO's catchphrase is "TRIPLE TROUBLE"
Output
INDETERMINATE

Nobody Left Test
Input
7 MELLOW YELLOW FELLOW BELLOW JELLO HELLO CELLO 4 Mayhem's hat is a LAUREL WREATH Mayhem's word is "DANGER" Mayhem's neckwear is an ASCOT Mayhem's companion is an AMORPHOUS BLOB 28 MELLOW's hat is a LAUREL WREATH YELLOW's hat is a LAUREL WREATH FELLOW's hat is a LAUREL WREATH BELLOW's hat is a LAUREL WREATH JELLO's hat is a LAUREL WREATH HELLO's hat is a LAMPSHADE CELLO's hat is a BOWLER MELLOW's neckwear is an ASCOT YELLOW's neckwear is an ASCOT FELLOW's neckwear is an ASCOT BELLOW's neckwear is a STETHOSCOPE JELLO's neckwear is an PENDANT HELLO's neckwear is an ASCOT CELLO's neckwear is an ASCOT MELLOW's companion is an AMORPHOUS BLOB YELLOW's companion is a FISH OUT OF WATER FELLOW's companion is an AMORPHOUS BLOB BELLOW's companion is an AMORPHOUS BLOB JELLO's companion is an AMORPHOUS BLOB HELLO's companion is an AMORPHOUS BLOB CELLO's companion is an AMORPHOUS BLOB MELLOW's catchphrase is "CARE for a game of CATCH" YELLOW's catchphrase is "FOLLOW me for DANGER" CELLO's catchphrase is "STRANGER DANGER" BELLOW's catchphrase is "DANGER is my MIDDLE name" JELLO's catchphrase is "I LIVE for DANGER" HELLO's catchphrase is "You are in DANGER of my WRATH" FELLOW's catchphrase is "TIPTOE through the TULIPS"
Output
MISSING

Nobody Left Validator
Input
7 ASTRONOMY BIOLOGY CHEMISTRY ZOOLOGY SCIENCE TECHNOLOGY FUN 4 Mayhem's hat is a TWEED DEERSTALKER Mayhem's word is "MOMMY" Mayhem's neckwear is a DAISY CHAIN Mayhem's companion is a POT OF PETUNIAS 28 BIOLOGY's neckwear is a DAISY CHAIN SCIENCE's catchphrase is "I LIVE for MOMMY" SCIENCE's companion is a POT OF PETUNIAS CHEMISTRY's hat is a TWEED DEERSTALKER ZOOLOGY's companion is a POT OF PETUNIAS TECHNOLOGY's companion is a POT OF PETUNIAS ASTRONOMY's catchphrase is "TAG you are IT" ASTRONOMY's companion is a POT OF PETUNIAS SCIENCE's neckwear is an LOCKET ZOOLOGY's catchphrase is "MOMMY is my MIDDLE name" ASTRONOMY's neckwear is a DAISY CHAIN TECHNOLOGY's catchphrase is "You will face the WRATH of my MOMMY" CHEMISTRY's neckwear is a DAISY CHAIN ASTRONOMY's hat is a TWEED DEERSTALKER BIOLOGY's hat is a TWEED DEERSTALKER FUN's catchphrase is "When is MOMMY coming HOME" ZOOLOGY's neckwear is a SPRIG OF PARSLEY TECHNOLOGY's hat is a STACK OF PANCAKES CHEMISTRY's companion is a POT OF PETUNIAS FUN's companion is a POT OF PETUNIAS ZOOLOGY's hat is a TWEED DEERSTALKER BIOLOGY's catchphrase is "Go CRY for your MOMMY" TECHNOLOGY's neckwear is a DAISY CHAIN FUN's hat is a TRICORNE FUN's neckwear is a DAISY CHAIN SCIENCE's hat is a TWEED DEERSTALKER BIOLOGY's companion is a SAPIENT PEARWOOD CHEST CHEMISTRY's catchphrase is "PUSSYFOOT through the PUSSYWILLOWS"
Output
MISSING

Only One Test
Input
1 SOLO 0 1 SOLO's catchphrase is "I have a BAD FEELING"
Output
SOLO

Only One Validator
Input
1 HIGHLANDER 1 Mayhem's companion is a BROADSWORD 0
Output
HIGHLANDER

Solution language

Solution

Stub generator input