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

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

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

m = A("m")
e = B("e")
j = C("j")
f = B("f")
h = C("h")
a = C("a")
l = A("l")
b = B("b")
g = A("g")
k = A("k")

m.p = l
m.x = k
e.q = b
e.s = b
e.w = k
j.p = m
j.u = a
j.w = a
f.q = e
f.s = b
f.w = l
h.p = m
h.u = a
h.w = a
a.p = l
a.u = j
a.w = h
l.p = g
l.x = m
b.q = e
b.s = f
b.w = l
g.p = l
g.x = m
k.p = l
k.x = m
assert b.q.s.q.w.x.p.p.x.p.txt == "
class A:
    def __init__(self, txt: str):
        self.p: A = None
        self.x: A = None
        self.txt = txt

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

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

m = A("m")
e = B("e")
j = C("j")
f = B("f")
h = C("h")
a = C("a")
l = A("l")
b = B("b")
g = A("g")
k = A("k")

m.p = l
m.x = k
e.q = b
e.s = b
e.w = k
j.p = m
j.u = a
j.w = a
f.q = e
f.s = b
f.w = l
h.p = m
h.u = a
h.w = a
a.p = l
a.u = j
a.w = h
l.p = g
l.x = m
b.q = e
b.s = f
b.w = l
g.p = l
g.x = m
k.p = l
k.x = m
assert b.q.s.q.w.x.p.p.x.p.txt == "l"