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

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

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

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

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

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

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

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

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

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

j.o = g
j.x = h
j.u = n
n.z = c
h.x = c
h.u = n
i.p = j
i.v = j
i.y = j
c.x = h
c.u = f
m.p = j
m.v = j
m.y = j
k.p = j
k.v = j
k.y = j
f.z = c
g.p = j
g.v = j
g.y = j
assert h.x.x.x.x.x.u.z.txt == "c"