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

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

class C:
    def __init__(self, txt: str):
        self.z: E = None
        self.v: B = None
        self.u: B = None
        self.x: A = None
        self.q: D = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.w: C = None
        self.txt = txt

c = A("c")
l = B("l")
e = C("e")
m = D("m")
j = E("j")
g = D("g")

c.r = m
c.u = m
l.z = c
l.q = e
e.z = j
e.v = l
e.u = l
e.x = c
e.q = m
m.s = g
j.w = e
g.s = m
assert e.q.s.s.s.s.txt == "
class A:
    def __init__(self, txt: str):
        self.r: D = None
        self.u: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.z: E = None
        self.v: B = None
        self.u: B = None
        self.x: A = None
        self.q: D = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.w: C = None
        self.txt = txt

c = A("c")
l = B("l")
e = C("e")
m = D("m")
j = E("j")
g = D("g")

c.r = m
c.u = m
l.z = c
l.q = e
e.z = j
e.v = l
e.u = l
e.x = c
e.q = m
m.s = g
j.w = e
g.s = m
assert e.q.s.s.s.s.txt == "m"