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

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

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

n = A("n")
i = B("i")
k = C("k")
d = A("d")
j = C("j")
c = B("c")
g = C("g")
h = C("h")
b = B("b")
f = C("f")

n.z = j
n.u = d
i.z = c
i.s = c
i.p = j
k.w = g
d.z = j
d.u = n
j.w = h
c.z = i
c.p = f
c.s = b
g.w = j
h.w = j
b.z = i
b.s = i
b.p = h
f.w = h
assert c.s.s.p.w.w.txt == "
class A:
    def __init__(self, txt: str):
        self.z: C = None
        self.u: A = None
        self.txt = txt

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

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

n = A("n")
i = B("i")
k = C("k")
d = A("d")
j = C("j")
c = B("c")
g = C("g")
h = C("h")
b = B("b")
f = C("f")

n.z = j
n.u = d
i.z = c
i.s = c
i.p = j
k.w = g
d.z = j
d.u = n
j.w = h
c.z = i
c.p = f
c.s = b
g.w = j
h.w = j
b.z = i
b.s = i
b.p = h
f.w = h
assert c.s.s.p.w.w.txt == "j"