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

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

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

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

class E:
    def __init__(self, txt: str):
        self.p: D = None
        self.q: B = None
        self.o: A = None
        self.z: E = None
        self.txt = txt

b = A("b")
m = B("m")
g = C("g")
k = D("k")
h = E("h")
d = E("d")

b.w = h
b.x = d
m.t = g
m.v = k
m.r = k
g.u = k
g.x = h
g.v = m
g.r = b
k.r = b
k.v = m
k.y = m
k.z = h
k.u = d
h.p = k
h.q = m
h.o = b
h.z = d
d.p = k
d.q = m
d.o = b
d.z = h
assert d.p.u.z.txt == "
class A:
    def __init__(self, txt: str):
        self.w: E = None
        self.x: E = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.p: D = None
        self.q: B = None
        self.o: A = None
        self.z: E = None
        self.txt = txt

b = A("b")
m = B("m")
g = C("g")
k = D("k")
h = E("h")
d = E("d")

b.w = h
b.x = d
m.t = g
m.v = k
m.r = k
g.u = k
g.x = h
g.v = m
g.r = b
k.r = b
k.v = m
k.y = m
k.z = h
k.u = d
h.p = k
h.q = m
h.o = b
h.z = d
d.p = k
d.q = m
d.o = b
d.z = h
assert d.p.u.z.txt == "h"