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

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

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

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

class E:
    def __init__(self, txt: str):
        self.q: B = None
        self.y: C = None
        self.r: C = None
        self.o: A = None
        self.txt = txt

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

e.p = k
e.q = c
e.s = h
m.w = c
m.y = k
m.p = h
m.v = e
c.x = m
c.v = h
k.w = c
h.q = m
h.y = c
h.r = c
h.o = e
assert c.v.r.v.y.x.txt == "
class A:
    def __init__(self, txt: str):
        self.p: D = None
        self.q: C = None
        self.s: E = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.q: B = None
        self.y: C = None
        self.r: C = None
        self.o: A = None
        self.txt = txt

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

e.p = k
e.q = c
e.s = h
m.w = c
m.y = k
m.p = h
m.v = e
c.x = m
c.v = h
k.w = c
h.q = m
h.y = c
h.r = c
h.o = e
assert c.v.r.v.y.x.txt == "m"