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

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

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

l = A("l")
n = B("n")
i = C("i")
h = B("h")
a = C("a")
j = C("j")
f = A("f")
d = A("d")
g = C("g")
k = B("k")

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

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

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

l = A("l")
n = B("n")
i = C("i")
h = B("h")
a = C("a")
j = C("j")
f = A("f")
d = A("d")
g = C("g")
k = B("k")

l.w = f
l.q = n
l.r = a
n.o = h
i.s = h
i.q = f
h.o = n
a.s = h
a.q = f
j.s = k
j.q = f
f.w = l
f.q = h
f.r = g
d.w = f
d.q = k
d.r = j
g.s = k
g.q = f
k.o = h
assert i.q.r.s.o.o.o.o.txt == "n"