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

class B:
    def __init__(self, txt: str):
        self.q: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.q: D = None
        self.w: E = None
        self.y: E = None
        self.u: B = None
        self.txt = txt

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

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

f = A("f")
b = B("b")
j = C("j")
c = D("c")
g = E("g")
m = B("m")
d = B("d")

f.z = g
f.w = g
f.r = b
f.u = d
b.q = g
j.q = c
j.w = g
j.y = g
j.u = d
c.r = f
g.u = d
g.y = j
g.z = j
g.o = m
m.q = g
d.q = g
assert c.r.u.q.u.q.o.txt == "
class A:
    def __init__(self, txt: str):
        self.z: E = None
        self.r: B = None
        self.w: E = None
        self.u: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.q: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.q: D = None
        self.w: E = None
        self.y: E = None
        self.u: B = None
        self.txt = txt

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

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

f = A("f")
b = B("b")
j = C("j")
c = D("c")
g = E("g")
m = B("m")
d = B("d")

f.z = g
f.w = g
f.r = b
f.u = d
b.q = g
j.q = c
j.w = g
j.y = g
j.u = d
c.r = f
g.u = d
g.y = j
g.z = j
g.o = m
m.q = g
d.q = g
assert c.r.u.q.u.q.o.txt == "m"