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

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

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

d = A("d")
b = B("b")
h = C("h")
a = A("a")
c = C("c")
k = A("k")

d.w = b
d.o = b
d.y = k
b.u = a
h.v = b
h.r = d
a.w = b
a.o = b
a.y = d
c.v = b
c.r = k
k.w = b
k.o = b
k.y = a
assert a.o.u.w.u.w.u.txt == "
class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.y: A = None
        self.o: B = None
        self.txt = txt

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

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

d = A("d")
b = B("b")
h = C("h")
a = A("a")
c = C("c")
k = A("k")

d.w = b
d.o = b
d.y = k
b.u = a
h.v = b
h.r = d
a.w = b
a.o = b
a.y = d
c.v = b
c.r = k
k.w = b
k.o = b
k.y = a
assert a.o.u.w.u.w.u.txt == "a"