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

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

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

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

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

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

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

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

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

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

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