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

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

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

j = A("j")
l = B("l")
h = C("h")
g = B("g")
c = A("c")
f = A("f")
b = A("b")
d = C("d")
a = B("a")

j.u = f
l.z = a
l.w = f
l.u = h
h.w = c
h.s = d
h.t = g
g.z = a
g.w = c
g.u = h
c.u = f
f.u = b
b.u = c
d.w = f
d.s = h
d.t = l
a.z = l
a.w = f
a.u = h
assert l.u.t.w.u.u.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.u: A = None
        self.txt = txt

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

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

j = A("j")
l = B("l")
h = C("h")
g = B("g")
c = A("c")
f = A("f")
b = A("b")
d = C("d")
a = B("a")

j.u = f
l.z = a
l.w = f
l.u = h
h.w = c
h.s = d
h.t = g
g.z = a
g.w = c
g.u = h
c.u = f
f.u = b
b.u = c
d.w = f
d.s = h
d.t = l
a.z = l
a.w = f
a.u = h
assert l.u.t.w.u.u.u.u.txt == "f"