class A:
    def __init__(self, txt: str):
        self.t: A = None
        self.z: A = None
        self.y: A = None
        self.o: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.p: D = None
        self.w: B = None
        self.v: A = None
        self.y: D = None
        self.txt = txt

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

m.t = n
m.z = n
m.y = n
m.o = d
h.x = n
h.p = k
d.z = g
d.u = g
d.x = h
c.p = g
c.y = g
c.w = e
c.v = n
a.p = c
a.w = e
a.v = m
a.y = g
n.t = m
n.z = m
n.y = m
n.o = k
e.x = m
e.p = k
k.z = a
k.x = h
k.u = c
g.p = a
g.y = a
g.w = h
g.v = m
assert a.w.x.o.txt == "
class A:
    def __init__(self, txt: str):
        self.t: A = None
        self.z: A = None
        self.y: A = None
        self.o: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.p: D = None
        self.w: B = None
        self.v: A = None
        self.y: D = None
        self.txt = txt

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

m.t = n
m.z = n
m.y = n
m.o = d
h.x = n
h.p = k
d.z = g
d.u = g
d.x = h
c.p = g
c.y = g
c.w = e
c.v = n
a.p = c
a.w = e
a.v = m
a.y = g
n.t = m
n.z = m
n.y = m
n.o = k
e.x = m
e.p = k
k.z = a
k.x = h
k.u = c
g.p = a
g.y = a
g.w = h
g.v = m
assert a.w.x.o.txt == "d"