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

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

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

a = A("a")
i = B("i")
e = C("e")
j = C("j")
h = A("h")
l = B("l")

a.t = i
a.w = j
i.x = l
i.o = a
e.x = l
e.v = a
j.x = i
j.v = h
h.t = i
h.w = j
l.x = i
l.o = h
assert i.x.x.o.t.o.w.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.w: C = None
        self.txt = txt

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

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

a = A("a")
i = B("i")
e = C("e")
j = C("j")
h = A("h")
l = B("l")

a.t = i
a.w = j
i.x = l
i.o = a
e.x = l
e.v = a
j.x = i
j.v = h
h.t = i
h.w = j
l.x = i
l.o = h
assert i.x.x.o.t.o.w.txt == "j"