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

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

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

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

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

b.u = d
b.y = d
b.w = j
b.t = k
d.t = b
d.u = k
d.z = f
j.q = a
n.z = j
k.t = b
k.u = d
k.z = a
a.z = j
h.z = j
l.t = b
l.u = d
l.z = h
i.t = b
i.u = d
i.z = a
f.z = j
assert n.z.q.z.q.z.q.z.q.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.y: B = None
        self.w: C = None
        self.t: B = None
        self.txt = txt

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

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

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

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

b.u = d
b.y = d
b.w = j
b.t = k
d.t = b
d.u = k
d.z = f
j.q = a
n.z = j
k.t = b
k.u = d
k.z = a
a.z = j
h.z = j
l.t = b
l.u = d
l.z = h
i.t = b
i.u = d
i.z = a
f.z = j
assert n.z.q.z.q.z.q.z.q.txt == "a"