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

class B:
    def __init__(self, txt: str):
        self.z: E = None
        self.r: C = None
        self.s: E = None
        self.txt = txt

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

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

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

c = A("c")
h = B("h")
e = C("e")
m = D("m")
a = E("a")
b = A("b")
k = A("k")
j = C("j")

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

class B:
    def __init__(self, txt: str):
        self.z: E = None
        self.r: C = None
        self.s: E = None
        self.txt = txt

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

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

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

c = A("c")
h = B("h")
e = C("e")
m = D("m")
a = E("a")
b = A("b")
k = A("k")
j = C("j")

c.u = b
c.z = h
c.w = h
h.z = a
h.s = a
h.r = j
e.s = a
e.q = h
m.y = h
a.o = c
b.u = k
b.z = h
b.w = h
k.u = b
k.z = h
k.w = h
j.s = a
j.q = h
assert e.q.r.s.o.w.z.o.txt == "c"