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

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

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

h = A("h")
d = B("d")
a = C("a")
f = C("f")
l = B("l")

h.v = f
h.o = d
d.w = a
d.u = h
a.s = h
a.x = d
f.s = h
f.x = l
l.w = a
l.u = h
assert l.u.o.w.x.txt == "
class A:
    def __init__(self, txt: str):
        self.v: C = None
        self.o: B = None
        self.txt = txt

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

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

h = A("h")
d = B("d")
a = C("a")
f = C("f")
l = B("l")

h.v = f
h.o = d
d.w = a
d.u = h
a.s = h
a.x = d
f.s = h
f.x = l
l.w = a
l.u = h
assert l.u.o.w.x.txt == "d"