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

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

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

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

c.w = h
c.z = g
c.r = f
g.o = d
d.u = l
d.s = g
l.u = h
l.s = n
j.o = h
n.o = d
f.w = l
f.z = n
f.r = c
h.u = d
h.s = j
assert l.s.o.s.o.s.o.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.z: B = None
        self.r: A = None
        self.txt = txt

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

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

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

c.w = h
c.z = g
c.r = f
g.o = d
d.u = l
d.s = g
l.u = h
l.s = n
j.o = h
n.o = d
f.w = l
f.z = n
f.r = c
h.u = d
h.s = j
assert l.s.o.s.o.s.o.u.u.txt == "h"