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

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

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

class D:
    def __init__(self, txt: str):
        self.w: B = None
        self.o: C = None
        self.p: B = None
        self.s: C = None
        self.txt = txt

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

m.t = n
m.q = n
m.z = f
g.z = b
n.u = b
n.y = k
b.w = i
b.o = n
b.s = n
b.p = a
a.z = b
d.t = n
d.q = n
d.z = f
f.t = n
f.q = n
f.z = m
j.z = b
k.z = b
i.z = b
assert k.z.s.y.txt == "
class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.z: A = None
        self.q: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.w: B = None
        self.o: C = None
        self.p: B = None
        self.s: C = None
        self.txt = txt

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

m.t = n
m.q = n
m.z = f
g.z = b
n.u = b
n.y = k
b.w = i
b.o = n
b.s = n
b.p = a
a.z = b
d.t = n
d.q = n
d.z = f
f.t = n
f.q = n
f.z = m
j.z = b
k.z = b
i.z = b
assert k.z.s.y.txt == "k"