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

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

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

j = A("j")
a = B("a")
c = C("c")
f = B("f")
i = A("i")
l = C("l")
n = B("n")
h = B("h")
m = A("m")

j.x = f
j.z = c
a.x = l
a.u = l
c.w = l
c.r = l
f.x = l
f.u = l
i.x = a
i.z = l
l.w = c
l.r = c
n.x = c
n.u = c
h.x = l
h.u = l
m.x = n
m.z = c
assert l.w.r.r.r.w.r.r.w.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.z: C = None
        self.txt = txt

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

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

j = A("j")
a = B("a")
c = C("c")
f = B("f")
i = A("i")
l = C("l")
n = B("n")
h = B("h")
m = A("m")

j.x = f
j.z = c
a.x = l
a.u = l
c.w = l
c.r = l
f.x = l
f.u = l
i.x = a
i.z = l
l.w = c
l.r = c
n.x = c
n.u = c
h.x = l
h.u = l
m.x = n
m.z = c
assert l.w.r.r.r.w.r.r.w.txt == "l"