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

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

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

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

class E:
    def __init__(self, txt: str):
        self.s: D = None
        self.w: D = None
        self.u: E = None
        self.txt = txt

k = A("k")
b = B("b")
i = C("i")
d = D("d")
a = E("a")
h = B("h")
l = E("l")
c = C("c")

k.x = d
b.r = i
b.o = d
b.s = h
b.q = h
i.z = c
d.u = k
d.s = h
d.y = h
d.o = b
a.s = d
a.w = d
a.u = l
h.r = c
h.o = d
h.s = b
h.q = b
l.s = d
l.w = d
l.u = a
c.z = i
assert i.z.z.z.txt == "
class A:
    def __init__(self, txt: str):
        self.x: D = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.s: D = None
        self.w: D = None
        self.u: E = None
        self.txt = txt

k = A("k")
b = B("b")
i = C("i")
d = D("d")
a = E("a")
h = B("h")
l = E("l")
c = C("c")

k.x = d
b.r = i
b.o = d
b.s = h
b.q = h
i.z = c
d.u = k
d.s = h
d.y = h
d.o = b
a.s = d
a.w = d
a.u = l
h.r = c
h.o = d
h.s = b
h.q = b
l.s = d
l.w = d
l.u = a
c.z = i
assert i.z.z.z.txt == "c"