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

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

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

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

class E:
    def __init__(self, txt: str):
        self.t: A = None
        self.s: D = None
        self.w: A = None
        self.o: C = None
        self.p: A = None
        self.txt = txt

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

e.y = k
e.s = c
m.y = e
m.u = f
n.w = m
f.x = m
c.t = e
c.w = e
c.p = e
c.s = f
c.o = n
k.x = m
assert n.w.u.x.y.txt == "
class A:
    def __init__(self, txt: str):
        self.y: D = None
        self.s: E = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.t: A = None
        self.s: D = None
        self.w: A = None
        self.o: C = None
        self.p: A = None
        self.txt = txt

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

e.y = k
e.s = c
m.y = e
m.u = f
n.w = m
f.x = m
c.t = e
c.w = e
c.p = e
c.s = f
c.o = n
k.x = m
assert n.w.u.x.y.txt == "e"