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

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

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

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

g = A("g")
m = B("m")
c = C("c")
i = D("i")
j = A("j")
k = D("k")
b = D("b")

g.z = c
g.u = c
g.o = m
g.y = m
m.q = k
m.r = c
m.w = c
c.t = m
i.y = j
i.s = b
j.z = c
j.u = c
j.o = m
j.y = m
k.y = g
k.s = i
b.y = g
b.s = k
assert k.y.o.r.t.q.s.txt == "
class A:
    def __init__(self, txt: str):
        self.z: C = None
        self.u: C = None
        self.o: B = None
        self.y: B = None
        self.txt = txt

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

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

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

g = A("g")
m = B("m")
c = C("c")
i = D("i")
j = A("j")
k = D("k")
b = D("b")

g.z = c
g.u = c
g.o = m
g.y = m
m.q = k
m.r = c
m.w = c
c.t = m
i.y = j
i.s = b
j.z = c
j.u = c
j.o = m
j.y = m
k.y = g
k.s = i
b.y = g
b.s = k
assert k.y.o.r.t.q.s.txt == "i"