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

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

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

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

c = A("c")
e = B("e")
h = C("h")
g = D("g")
b = C("b")
k = B("k")
a = C("a")
m = C("m")
d = A("d")
i = D("i")

c.z = i
c.q = k
c.w = d
c.x = d
e.o = d
h.u = c
h.t = k
h.p = a
g.r = a
g.p = k
b.u = c
b.t = e
b.p = h
k.o = c
a.u = c
a.t = k
a.p = b
m.u = d
m.t = e
m.p = a
d.z = i
d.q = k
d.w = c
d.x = c
i.r = m
i.p = k
assert m.t.o.w.w.z.p.txt == "
class A:
    def __init__(self, txt: str):
        self.z: D = None
        self.q: B = None
        self.w: A = None
        self.x: A = None
        self.txt = txt

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

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

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

c = A("c")
e = B("e")
h = C("h")
g = D("g")
b = C("b")
k = B("k")
a = C("a")
m = C("m")
d = A("d")
i = D("i")

c.z = i
c.q = k
c.w = d
c.x = d
e.o = d
h.u = c
h.t = k
h.p = a
g.r = a
g.p = k
b.u = c
b.t = e
b.p = h
k.o = c
a.u = c
a.t = k
a.p = b
m.u = d
m.t = e
m.p = a
d.z = i
d.q = k
d.w = c
d.x = c
i.r = m
i.p = k
assert m.t.o.w.w.z.p.txt == "k"