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

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

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

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

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

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

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

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

n.p = g
n.t = h
n.u = j
k.z = c
g.w = n
g.u = j
g.x = d
d.w = n
d.u = h
d.x = g
c.z = k
f.z = k
h.p = g
h.t = j
h.u = j
j.p = d
j.t = n
j.u = n
assert g.w.u.p.x.txt == "g"