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

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

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

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

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

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

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

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

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