class A:
    def __init__(self, txt: str):
        self.t: D = None
        self.u: C = None
        self.z: D = None
        self.r: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.q: A = None
        self.s: A = None
        self.o: A = None
        self.y: D = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.u: D = None
        self.txt = txt

k = A("k")
l = B("l")
c = C("c")
d = D("d")
h = D("h")
n = A("n")
e = A("e")
j = C("j")
m = B("m")
b = D("b")

k.t = d
k.u = j
k.z = h
k.r = c
l.q = n
l.s = n
l.o = k
l.y = b
c.z = m
c.v = n
c.p = b
d.u = h
h.u = b
n.t = h
n.u = c
n.z = d
n.r = j
e.t = d
e.u = j
e.z = b
e.r = c
j.z = l
j.v = e
j.p = d
m.q = e
m.s = k
m.o = k
m.y = d
b.u = d
assert k.t.u.u.u.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.t: D = None
        self.u: C = None
        self.z: D = None
        self.r: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.q: A = None
        self.s: A = None
        self.o: A = None
        self.y: D = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.u: D = None
        self.txt = txt

k = A("k")
l = B("l")
c = C("c")
d = D("d")
h = D("h")
n = A("n")
e = A("e")
j = C("j")
m = B("m")
b = D("b")

k.t = d
k.u = j
k.z = h
k.r = c
l.q = n
l.s = n
l.o = k
l.y = b
c.z = m
c.v = n
c.p = b
d.u = h
h.u = b
n.t = h
n.u = c
n.z = d
n.r = j
e.t = d
e.u = j
e.z = b
e.r = c
j.z = l
j.v = e
j.p = d
m.q = e
m.s = k
m.o = k
m.y = d
b.u = d
assert k.t.u.u.u.u.u.txt == "b"