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

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

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

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

a.w = j
b.y = f
b.o = a
b.q = n
j.u = a
i.y = m
i.o = c
i.q = n
c.w = j
l.y = b
l.o = a
l.q = n
m.y = l
m.o = c
m.q = n
n.u = c
f.y = m
f.o = c
f.q = n
assert a.w.u.w.u.w.u.w.u.txt == "
class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.txt = txt

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

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

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

a.w = j
b.y = f
b.o = a
b.q = n
j.u = a
i.y = m
i.o = c
i.q = n
c.w = j
l.y = b
l.o = a
l.q = n
m.y = l
m.o = c
m.q = n
n.u = c
f.y = m
f.o = c
f.q = n
assert a.w.u.w.u.w.u.w.u.txt == "a"