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

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

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

j = A("j")
b = B("b")
c = C("c")
l = B("l")
m = C("m")
d = A("d")
e = B("e")
g = B("g")
h = B("h")

j.y = d
j.p = e
j.o = c
b.q = l
b.z = m
b.p = m
c.w = l
l.q = g
l.z = c
l.p = c
m.w = e
d.y = j
d.p = h
d.o = m
e.q = l
e.z = m
e.p = m
g.q = h
g.z = m
g.p = m
h.q = l
h.z = c
h.p = m
assert c.w.p.w.txt == "
class A:
    def __init__(self, txt: str):
        self.y: A = None
        self.p: B = None
        self.o: C = None
        self.txt = txt

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

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

j = A("j")
b = B("b")
c = C("c")
l = B("l")
m = C("m")
d = A("d")
e = B("e")
g = B("g")
h = B("h")

j.y = d
j.p = e
j.o = c
b.q = l
b.z = m
b.p = m
c.w = l
l.q = g
l.z = c
l.p = c
m.w = e
d.y = j
d.p = h
d.o = m
e.q = l
e.z = m
e.p = m
g.q = h
g.z = m
g.p = m
h.q = l
h.z = c
h.p = m
assert c.w.p.w.txt == "l"