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

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

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

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

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

n.t = f
n.x = e
k.s = h
k.y = c
k.x = e
e.z = c
e.x = c
j.u = e
h.t = n
h.x = c
g.s = h
g.y = e
g.x = e
i.s = n
i.y = e
i.x = e
m.s = h
m.y = e
m.x = e
f.t = h
f.x = e
c.z = e
c.x = e
assert c.x.z.x.z.z.x.x.txt == "
class A:
    def __init__(self, txt: str):
        self.t: A = None
        self.x: C = None
        self.txt = txt

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

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

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

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

n.t = f
n.x = e
k.s = h
k.y = c
k.x = e
e.z = c
e.x = c
j.u = e
h.t = n
h.x = c
g.s = h
g.y = e
g.x = e
i.s = n
i.y = e
i.x = e
m.s = h
m.y = e
m.x = e
f.t = h
f.x = e
c.z = e
c.x = e
assert c.x.z.x.z.z.x.x.txt == "e"