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

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

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

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

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

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

b.r = m
b.x = m
b.q = i
b.s = f
m.z = l
i.y = m
i.u = b
k.r = e
k.x = i
k.q = f
f.z = k
f.w = e
f.r = b
f.x = l
l.r = e
l.q = e
l.x = i
e.z = l
e.x = l
e.w = f
e.r = b
assert k.x.u.r.z.x.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.q: C = None
        self.x: B = None
        self.s: E = None
        self.txt = txt

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

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

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

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

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

b.r = m
b.x = m
b.q = i
b.s = f
m.z = l
i.y = m
i.u = b
k.r = e
k.x = i
k.q = f
f.z = k
f.w = e
f.r = b
f.x = l
l.r = e
l.q = e
l.x = i
e.z = l
e.x = l
e.w = f
e.r = b
assert k.x.u.r.z.x.txt == "i"