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

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

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

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

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

d = A("d")
k = B("k")
n = C("n")
m = D("m")
g = E("g")
l = A("l")
f = A("f")
i = C("i")
c = A("c")

d.z = m
d.y = m
d.w = m
d.u = g
d.x = f
k.r = l
k.z = l
k.p = g
n.p = l
n.z = k
n.o = m
m.r = k
m.w = c
m.z = g
m.s = g
g.r = m
l.z = m
l.y = m
l.w = m
l.u = g
l.x = d
f.z = m
f.y = m
f.w = m
f.u = g
f.x = d
i.p = d
i.z = k
i.o = m
c.z = m
c.y = m
c.w = m
c.u = g
c.x = d
assert d.u.r.w.u.txt == "
class A:
    def __init__(self, txt: str):
        self.z: D = None
        self.y: D = None
        self.w: D = None
        self.u: E = None
        self.x: A = None
        self.txt = txt

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

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

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

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

d = A("d")
k = B("k")
n = C("n")
m = D("m")
g = E("g")
l = A("l")
f = A("f")
i = C("i")
c = A("c")

d.z = m
d.y = m
d.w = m
d.u = g
d.x = f
k.r = l
k.z = l
k.p = g
n.p = l
n.z = k
n.o = m
m.r = k
m.w = c
m.z = g
m.s = g
g.r = m
l.z = m
l.y = m
l.w = m
l.u = g
l.x = d
f.z = m
f.y = m
f.w = m
f.u = g
f.x = d
i.p = d
i.z = k
i.o = m
c.z = m
c.y = m
c.w = m
c.u = g
c.x = d
assert d.u.r.w.u.txt == "g"