class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.t: A = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.w: B = None
        self.p: A = None
        self.txt = txt

b = A("b")
d = B("d")
a = B("a")
n = B("n")
i = A("i")
g = A("g")
h = B("h")
m = B("m")
j = A("j")
e = B("e")

b.v = n
b.t = i
d.w = h
d.p = g
a.w = h
a.p = j
n.w = d
n.p = i
i.v = m
i.t = j
g.v = a
g.t = j
h.w = a
h.p = b
m.w = d
m.p = i
j.v = a
j.t = b
e.w = n
e.p = j
assert n.w.w.w.w.w.p.v.w.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.t: A = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.w: B = None
        self.p: A = None
        self.txt = txt

b = A("b")
d = B("d")
a = B("a")
n = B("n")
i = A("i")
g = A("g")
h = B("h")
m = B("m")
j = A("j")
e = B("e")

b.v = n
b.t = i
d.w = h
d.p = g
a.w = h
a.p = j
n.w = d
n.p = i
i.v = m
i.t = j
g.v = a
g.t = j
h.w = a
h.p = b
m.w = d
m.p = i
j.v = a
j.t = b
e.w = n
e.p = j
assert n.w.w.w.w.w.p.v.w.txt == "h"