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

class B:
    def __init__(self, txt: str):
        self.v: C = None
        self.q: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.o: A = None
        self.u: A = None
        self.txt = txt

h = A("h")
k = B("k")
j = C("j")
n = C("n")
d = C("d")
l = B("l")
b = C("b")
g = C("g")
a = A("a")
e = A("e")

h.p = k
k.v = j
k.q = j
j.o = a
j.u = e
n.o = e
n.u = h
d.o = h
d.u = a
l.v = n
l.q = d
b.o = h
b.u = h
g.o = a
g.u = h
a.p = k
e.p = l
assert j.o.p.q.u.txt == "
class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.v: C = None
        self.q: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.o: A = None
        self.u: A = None
        self.txt = txt

h = A("h")
k = B("k")
j = C("j")
n = C("n")
d = C("d")
l = B("l")
b = C("b")
g = C("g")
a = A("a")
e = A("e")

h.p = k
k.v = j
k.q = j
j.o = a
j.u = e
n.o = e
n.u = h
d.o = h
d.u = a
l.v = n
l.q = d
b.o = h
b.u = h
g.o = a
g.u = h
a.p = k
e.p = l
assert j.o.p.q.u.txt == "e"