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

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

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

j = A("j")
c = B("c")
l = C("l")
h = B("h")
d = B("d")
a = A("a")

j.w = a
j.o = l
j.p = c
c.x = a
c.w = l
l.v = a
l.q = d
h.x = j
h.w = l
d.x = a
d.w = l
a.w = j
a.o = l
a.p = c
assert c.x.p.w.q.w.txt == "
class A:
    def __init__(self, txt: str):
        self.w: A = None
        self.o: C = None
        self.p: B = None
        self.txt = txt

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

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

j = A("j")
c = B("c")
l = C("l")
h = B("h")
d = B("d")
a = A("a")

j.w = a
j.o = l
j.p = c
c.x = a
c.w = l
l.v = a
l.q = d
h.x = j
h.w = l
d.x = a
d.w = l
a.w = j
a.o = l
a.p = c
assert c.x.p.w.q.w.txt == "l"