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

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

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

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

h = A("h")
b = B("b")
f = C("f")
n = D("n")
j = B("j")
k = A("k")
e = B("e")
d = D("d")
g = D("g")

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

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

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

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

h = A("h")
b = B("b")
f = C("f")
n = D("n")
j = B("j")
k = A("k")
e = B("e")
d = D("d")
g = D("g")

h.z = e
h.o = j
h.u = g
b.w = j
b.s = f
b.p = f
f.p = n
f.t = e
n.x = j
j.w = e
j.s = f
j.p = f
k.z = e
k.o = b
k.u = n
e.w = j
e.s = f
e.p = f
d.x = b
g.x = b
assert k.z.s.t.w.s.t.p.p.txt == "n"