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

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

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

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

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

b = A("b")
a = B("a")
i = C("i")
k = D("k")
m = E("m")
j = B("j")

b.x = i
b.u = j
b.s = k
a.r = i
a.y = b
i.z = a
i.y = b
i.v = b
i.t = m
k.z = i
m.z = b
j.r = i
j.y = b
assert a.y.x.z.r.t.txt == "
class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.u: B = None
        self.s: D = None
        self.txt = txt

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

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

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

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

b = A("b")
a = B("a")
i = C("i")
k = D("k")
m = E("m")
j = B("j")

b.x = i
b.u = j
b.s = k
a.r = i
a.y = b
i.z = a
i.y = b
i.v = b
i.t = m
k.z = i
m.z = b
j.r = i
j.y = b
assert a.y.x.z.r.t.txt == "m"