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

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

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

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

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

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

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

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

j.y = c
j.w = g
n.x = c
h.o = j
h.x = l
c.o = m
c.x = d
g.o = d
g.x = j
d.y = c
d.w = h
m.y = h
m.w = h
e.x = c
l.y = g
l.w = h
assert c.o.w.x.txt == "l"