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

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

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

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

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

b = A("b")
l = B("l")
a = C("a")
m = D("m")
f = E("f")

b.r = m
l.y = b
l.u = b
l.q = b
a.u = m
a.t = f
m.z = a
m.q = a
m.t = f
m.s = b
f.y = b
f.v = l
assert a.t.y.r.z.txt == "
class A:
    def __init__(self, txt: str):
        self.r: D = None
        self.txt = txt

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

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

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

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

b = A("b")
l = B("l")
a = C("a")
m = D("m")
f = E("f")

b.r = m
l.y = b
l.u = b
l.q = b
a.u = m
a.t = f
m.z = a
m.q = a
m.t = f
m.s = b
f.y = b
f.v = l
assert a.t.y.r.z.txt == "a"