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

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

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

class D:
    def __init__(self, txt: str):
        self.t: C = None
        self.w: B = None
        self.v: E = None
        self.z: E = None
        self.q: C = None
        self.txt = txt

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

i = A("i")
m = B("m")
n = C("n")
e = D("e")
f = E("f")

i.q = m
i.s = n
m.p = n
m.y = i
n.o = i
n.x = e
e.t = n
e.q = n
e.w = m
e.v = f
e.z = f
f.r = m
f.z = m
f.x = n
f.t = n
f.q = n
assert e.w.y.s.x.z.txt == "
class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.s: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.t: C = None
        self.w: B = None
        self.v: E = None
        self.z: E = None
        self.q: C = None
        self.txt = txt

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

i = A("i")
m = B("m")
n = C("n")
e = D("e")
f = E("f")

i.q = m
i.s = n
m.p = n
m.y = i
n.o = i
n.x = e
e.t = n
e.q = n
e.w = m
e.v = f
e.z = f
f.r = m
f.z = m
f.x = n
f.t = n
f.q = n
assert e.w.y.s.x.z.txt == "f"