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

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

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

n = A("n")
j = B("j")
h = C("h")
g = B("g")
i = B("i")
c = C("c")
e = C("e")

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

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

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

n = A("n")
j = B("j")
h = C("h")
g = B("g")
i = B("i")
c = C("c")
e = C("e")

n.z = i
n.u = h
n.v = j
j.s = n
h.z = c
h.v = c
h.x = j
g.s = n
i.s = n
c.z = h
c.v = h
c.x = j
e.z = h
e.v = h
e.x = i
assert g.s.v.s.v.s.u.txt == "h"