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

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

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

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

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

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

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

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

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

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

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

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

e.o = m
e.y = m
k.q = i
k.u = e
k.p = e
k.o = m
k.y = m
m.w = e
m.v = e
m.o = i
i.r = e
i.x = m
i.w = m
f.p = e
f.q = e
assert f.p.y.v.txt == "e"