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

class B:
    def __init__(self, txt: str):
        self.r: E = None
        self.t: D = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.w: D = None
        self.r: B = None
        self.v: B = None
        self.p: C = None
        self.q: A = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.r: E = None
        self.t: D = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.w: D = None
        self.r: B = None
        self.v: B = None
        self.p: C = None
        self.q: A = None
        self.txt = txt

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

k.w = l
b.r = g
b.t = i
f.u = b
f.w = b
f.t = l
i.r = j
i.t = j
i.v = m
i.z = g
g.w = i
g.r = b
g.v = b
g.p = m
g.q = k
j.r = i
j.t = i
j.v = m
j.z = g
m.u = b
m.w = b
m.t = k
l.w = k
assert b.r.q.w.txt == "l"