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

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

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

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

k = A("k")
b = B("b")
d = C("d")
h = D("h")
f = A("f")
n = D("n")
j = A("j")
a = D("a")

k.t = b
k.z = f
k.o = j
b.y = d
b.s = f
d.z = a
d.r = n
h.s = b
h.q = b
f.t = b
f.z = k
f.o = j
n.s = b
n.q = b
j.t = b
j.z = k
j.o = k
a.s = b
a.q = b
assert b.s.z.z.o.t.y.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.z: A = None
        self.o: A = None
        self.txt = txt

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

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

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

k = A("k")
b = B("b")
d = C("d")
h = D("h")
f = A("f")
n = D("n")
j = A("j")
a = D("a")

k.t = b
k.z = f
k.o = j
b.y = d
b.s = f
d.z = a
d.r = n
h.s = b
h.q = b
f.t = b
f.z = k
f.o = j
n.s = b
n.q = b
j.t = b
j.z = k
j.o = k
a.s = b
a.q = b
assert b.s.z.z.o.t.y.txt == "d"