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

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

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

h = A("h")
g = B("g")
j = C("j")
n = C("n")
d = A("d")
l = B("l")
m = A("m")
i = B("i")
b = A("b")

h.p = j
h.u = m
h.v = b
g.o = m
j.w = n
j.z = n
n.w = j
n.z = j
d.p = n
d.u = h
d.v = h
l.o = m
m.p = j
m.u = d
m.v = d
i.o = h
b.p = n
b.u = m
b.v = h
assert g.o.u.p.z.w.txt == "
class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.u: A = None
        self.v: A = None
        self.txt = txt

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

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

h = A("h")
g = B("g")
j = C("j")
n = C("n")
d = A("d")
l = B("l")
m = A("m")
i = B("i")
b = A("b")

h.p = j
h.u = m
h.v = b
g.o = m
j.w = n
j.z = n
n.w = j
n.z = j
d.p = n
d.u = h
d.v = h
l.o = m
m.p = j
m.u = d
m.v = d
i.o = h
b.p = n
b.u = m
b.v = h
assert g.o.u.p.z.w.txt == "n"