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

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

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

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

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

h = A("h")
n = B("n")
m = C("m")
k = D("k")
c = E("c")

h.s = k
h.z = c
h.q = n
n.z = c
m.o = h
k.w = c
k.o = c
k.r = c
c.z = n
assert c.z.z.z.z.z.txt == "
class A:
    def __init__(self, txt: str):
        self.s: D = None
        self.z: E = None
        self.q: B = None
        self.txt = txt

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

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

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

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

h = A("h")
n = B("n")
m = C("m")
k = D("k")
c = E("c")

h.s = k
h.z = c
h.q = n
n.z = c
m.o = h
k.w = c
k.o = c
k.r = c
c.z = n
assert c.z.z.z.z.z.txt == "n"