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

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

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

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

a = A("a")
m = B("m")
g = C("g")
n = D("n")
l = C("l")
i = A("i")
h = D("h")
e = C("e")
f = B("f")
d = A("d")

a.u = d
a.t = e
m.s = l
m.p = i
m.z = f
m.x = d
g.t = h
g.w = n
g.p = i
n.o = h
l.t = n
l.w = n
l.p = a
i.u = d
i.t = l
h.o = n
e.t = n
e.w = n
e.p = d
f.s = g
f.p = d
f.z = m
f.x = i
d.u = a
d.t = e
assert i.t.p.t.w.o.txt == "
class A:
    def __init__(self, txt: str):
        self.u: A = None
        self.t: C = None
        self.txt = txt

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

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

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

a = A("a")
m = B("m")
g = C("g")
n = D("n")
l = C("l")
i = A("i")
h = D("h")
e = C("e")
f = B("f")
d = A("d")

a.u = d
a.t = e
m.s = l
m.p = i
m.z = f
m.x = d
g.t = h
g.w = n
g.p = i
n.o = h
l.t = n
l.w = n
l.p = a
i.u = d
i.t = l
h.o = n
e.t = n
e.w = n
e.p = d
f.s = g
f.p = d
f.z = m
f.x = i
d.u = a
d.t = e
assert i.t.p.t.w.o.txt == "h"