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

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

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

b = A("b")
e = B("e")
c = C("c")
j = C("j")
f = A("f")
h = C("h")
n = C("n")
a = B("a")

b.u = c
e.z = f
e.t = a
c.y = b
c.p = b
c.w = f
j.y = b
j.w = b
j.p = f
f.u = n
h.y = b
h.p = f
h.w = f
n.y = b
n.p = b
n.w = f
a.z = b
a.t = e
assert h.w.u.y.u.w.u.txt == "
class A:
    def __init__(self, txt: str):
        self.u: C = None
        self.txt = txt

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

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

b = A("b")
e = B("e")
c = C("c")
j = C("j")
f = A("f")
h = C("h")
n = C("n")
a = B("a")

b.u = c
e.z = f
e.t = a
c.y = b
c.p = b
c.w = f
j.y = b
j.w = b
j.p = f
f.u = n
h.y = b
h.p = f
h.w = f
n.y = b
n.p = b
n.w = f
a.z = b
a.t = e
assert h.w.u.y.u.w.u.txt == "n"