class A:
    def __init__(self, txt: str):
        self.t: E = None
        self.v: C = None
        self.p: D = None
        self.u: C = None
        self.r: E = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.r: B = None
        self.u: E = None
        self.t: E = None
        self.o: C = None
        self.txt = txt

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

f = A("f")
d = B("d")
i = C("i")
m = D("m")
l = E("l")

f.t = l
f.r = l
f.v = i
f.u = i
f.p = m
d.s = l
d.x = f
i.t = d
i.r = d
i.z = f
m.r = d
m.u = l
m.t = l
m.o = i
l.t = m
l.q = i
assert m.r.s.t.txt == "
class A:
    def __init__(self, txt: str):
        self.t: E = None
        self.v: C = None
        self.p: D = None
        self.u: C = None
        self.r: E = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.r: B = None
        self.u: E = None
        self.t: E = None
        self.o: C = None
        self.txt = txt

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

f = A("f")
d = B("d")
i = C("i")
m = D("m")
l = E("l")

f.t = l
f.r = l
f.v = i
f.u = i
f.p = m
d.s = l
d.x = f
i.t = d
i.r = d
i.z = f
m.r = d
m.u = l
m.t = l
m.o = i
l.t = m
l.q = i
assert m.r.s.t.txt == "m"