class Node {

        private final long hash;
        private String tag;
        private final Map<Long, Node> children;
        private long tagOffset;
        private long childOffset;

        Node(long hash, String tag) {
            this.hash = hash;
            this.tag = tag;
            children = new TreeMap<>();
        }

        public Node put(long hash, String desc) {
            return children.computeIfAbsent(hash, newNode -> new Node(hash, desc));
        }

        public Node get(long hash) {
            return children.get(hash);
        }
    }

    public static long myHash(String name) {
        if (name == null || name.length() == 0) {
            return 0;
        }
        long hash = 2861;
        int n = name.length();
        if (n > 100) {
            n = 100;
        }
        for (int i = 0; i < n; i++) {
            hash = (hash * 641L + name.charAt(i) * 2969 + hash << 6) % 9322397;
        }
        return hash;
    }

    private void write(Node n, DataOutputStream out) throws IOException {<FILL_FUNCTION_BODY>

        if (n.tag != null) {
            out.write(n.tag.getBytes());
            offset += n.tag.length();
        }
        for (Node childNode : n.children.values()) {
            out.writeLong(childNode.hash);
            if (childNode.children.size() > 0) {
                out.writeShort((short) (childNode.childOffset - offset));
                out.writeShort((short) childNode.children.size());
            } else {
                out.writeShort(0);
                if (childNode.tag == null) {
                    out.writeShort((short) 0);
                } else {
                    out.writeShort((short) childNode.tag.length());
                }
            }
            if (childNode.tag == null) {
                out.writeShort(0);
            } else {
                out.writeShort((short) (childNode.tagOffset - offset));
            }
            offset += RECORD_LENGTH;
        }
        for (Node childNode : n.children.values()) {
            write(childNode, out);
        }
    
<no_super_class>