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

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

class C:
    def __init__(self, txt: str):
        self.y: C = None
        self.s: C = None
        self.txt = txt

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

d = A("d")
n = B("n")
e = C("e")
h = D("h")
k = B("k")
i = D("i")
m = B("m")
a = A("a")
b = C("b")
c = D("c")

d.o = c
d.w = n
d.z = m
d.p = b
n.z = d
n.u = m
n.x = e
e.y = b
e.s = b
h.r = i
h.o = e
k.z = d
k.u = m
k.x = b
i.r = h
i.o = b
m.z = d
m.u = n
m.x = e
a.o = h
a.w = n
a.z = m
a.p = b
b.y = e
b.s = e
c.r = h
c.o = b
assert e.y.s.y.txt == "
class A:
    def __init__(self, txt: str):
        self.o: D = None
        self.w: B = None
        self.z: B = None
        self.p: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.y: C = None
        self.s: C = None
        self.txt = txt

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

d = A("d")
n = B("n")
e = C("e")
h = D("h")
k = B("k")
i = D("i")
m = B("m")
a = A("a")
b = C("b")
c = D("c")

d.o = c
d.w = n
d.z = m
d.p = b
n.z = d
n.u = m
n.x = e
e.y = b
e.s = b
h.r = i
h.o = e
k.z = d
k.u = m
k.x = b
i.r = h
i.o = b
m.z = d
m.u = n
m.x = e
a.o = h
a.w = n
a.z = m
a.p = b
b.y = e
b.s = e
c.r = h
c.o = b
assert e.y.s.y.txt == "b"