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

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

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

a = A("a")
l = B("l")
c = C("c")
h = A("h")
e = A("e")
m = C("m")
n = C("n")
b = B("b")
j = C("j")

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

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

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

a = A("a")
l = B("l")
c = C("c")
h = A("h")
e = A("e")
m = C("m")
n = C("n")
b = B("b")
j = C("j")

a.q = m
a.u = h
l.s = e
l.w = b
c.p = a
c.o = a
h.q = c
h.u = e
e.q = c
e.u = h
m.p = h
m.o = a
n.p = e
n.o = h
b.s = e
b.w = l
j.p = h
j.o = a
assert l.w.s.q.p.txt == "a"