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

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

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

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

class E:
    def __init__(self, txt: str):
        self.v: D = None
        self.t: A = None
        self.p: E = None
        self.txt = txt

g = A("g")
b = B("b")
k = C("k")
m = D("m")
f = E("f")
e = E("e")
j = A("j")

g.q = k
g.s = j
g.z = j
b.w = g
b.u = f
b.p = k
b.s = k
b.x = m
k.u = b
k.r = b
k.x = e
k.o = j
m.o = g
m.q = k
m.z = k
m.u = j
f.v = m
f.t = g
f.p = e
e.v = m
e.t = j
e.p = f
j.q = k
j.s = g
j.z = g
assert b.w.q.x.v.u.txt == "
class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.s: A = None
        self.z: A = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.v: D = None
        self.t: A = None
        self.p: E = None
        self.txt = txt

g = A("g")
b = B("b")
k = C("k")
m = D("m")
f = E("f")
e = E("e")
j = A("j")

g.q = k
g.s = j
g.z = j
b.w = g
b.u = f
b.p = k
b.s = k
b.x = m
k.u = b
k.r = b
k.x = e
k.o = j
m.o = g
m.q = k
m.z = k
m.u = j
f.v = m
f.t = g
f.p = e
e.v = m
e.t = j
e.p = f
j.q = k
j.s = g
j.z = g
assert b.w.q.x.v.u.txt == "j"