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

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

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

class D:
    def __init__(self, txt: str):
        self.z: C = None
        self.s: B = None
        self.x: E = None
        self.txt = txt

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

a = A("a")
f = B("f")
d = C("d")
n = D("n")
b = E("b")
k = C("k")
i = A("i")
h = D("h")
m = C("m")
g = D("g")

a.z = n
a.u = i
a.s = b
f.t = m
f.u = h
f.v = n
f.z = i
d.q = f
d.w = f
d.y = f
n.z = k
n.s = f
n.x = b
b.z = n
b.w = a
k.q = f
k.w = f
k.y = f
i.z = g
i.u = a
i.s = b
h.z = m
h.s = f
h.x = b
m.q = f
m.w = f
m.y = f
g.z = k
g.s = f
g.x = b
assert d.q.u.x.txt == "
class A:
    def __init__(self, txt: str):
        self.z: D = None
        self.u: A = None
        self.s: E = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.z: C = None
        self.s: B = None
        self.x: E = None
        self.txt = txt

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

a = A("a")
f = B("f")
d = C("d")
n = D("n")
b = E("b")
k = C("k")
i = A("i")
h = D("h")
m = C("m")
g = D("g")

a.z = n
a.u = i
a.s = b
f.t = m
f.u = h
f.v = n
f.z = i
d.q = f
d.w = f
d.y = f
n.z = k
n.s = f
n.x = b
b.z = n
b.w = a
k.q = f
k.w = f
k.y = f
i.z = g
i.u = a
i.s = b
h.z = m
h.s = f
h.x = b
m.q = f
m.w = f
m.y = f
g.z = k
g.s = f
g.x = b
assert d.q.u.x.txt == "b"