/* package whatever; // don't place package name! */
import java.util.*;
import java.util.function.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
{
}
private static class Player {}
private static class NPC {}
private Node head;
public DialogueTree() {
head
= new Node
((BiPredicate
<Player,NPC
> & Serializable)(p,q
) -> true); }
public DialogueTree add(int[] path, BiPredicate<Player,NPC> req) {
head.children.add(new Node(req));
return this;
}
public List<Node> children;
public BiPredicate<Player,NPC> req;
public Node(BiPredicate<Player,NPC> req) {
this.req = req;
}
}
}
}
LyogcGFja2FnZSB3aGF0ZXZlcjsgLy8gZG9uJ3QgcGxhY2UgcGFja2FnZSBuYW1lISAqLwoKaW1wb3J0IGphdmEudXRpbC4qOwppbXBvcnQgamF2YS51dGlsLmZ1bmN0aW9uLio7CmltcG9ydCBqYXZhLmxhbmcuKjsKaW1wb3J0IGphdmEuaW8uKjsKCi8qIE5hbWUgb2YgdGhlIGNsYXNzIGhhcyB0byBiZSAiTWFpbiIgb25seSBpZiB0aGUgY2xhc3MgaXMgcHVibGljLiAqLwpjbGFzcyBJZGVvbmUKewoJcHVibGljIHN0YXRpYyB2b2lkIG1haW4gKFN0cmluZ1tdIGFyZ3MpIHRocm93cyBqYXZhLmxhbmcuRXhjZXB0aW9uCgl7CgkJU3lzdGVtLm91dC5wcmludGxuKG5ldyBEaWFsb2d1ZVRyZWUoKS5oZWFkLnJlcSBpbnN0YW5jZW9mIFNlcmlhbGl6YWJsZSk7Cgl9CgkKCXByaXZhdGUgc3RhdGljIGNsYXNzIFBsYXllciB7fQoJcHJpdmF0ZSBzdGF0aWMgY2xhc3MgTlBDIHt9CgkKCXB1YmxpYyBzdGF0aWMgY2xhc3MgRGlhbG9ndWVUcmVlIGltcGxlbWVudHMgU2VyaWFsaXphYmxlIHsKCgkgICAgcHJpdmF0ZSBOb2RlIGhlYWQ7CgkKCSAgICBwdWJsaWMgRGlhbG9ndWVUcmVlKCkgewoJICAgICAgICBoZWFkID0gbmV3IE5vZGUoKEJ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