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

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

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

b = A("b")
n = B("n")
j = C("j")
f = A("f")
c = C("c")
l = B("l")
d = A("d")
a = C("a")
k = B("k")

b.v = a
b.r = c
n.x = c
j.y = l
j.w = c
f.v = a
f.r = j
c.y = l
c.w = a
l.x = j
d.v = c
d.r = c
a.y = l
a.w = c
k.x = j
assert b.r.y.x.w.w.txt == "
class A:
    def __init__(self, txt: str):
        self.v: C = None
        self.r: C = None
        self.txt = txt

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

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

b = A("b")
n = B("n")
j = C("j")
f = A("f")
c = C("c")
l = B("l")
d = A("d")
a = C("a")
k = B("k")

b.v = a
b.r = c
n.x = c
j.y = l
j.w = c
f.v = a
f.r = j
c.y = l
c.w = a
l.x = j
d.v = c
d.r = c
a.y = l
a.w = c
k.x = j
assert b.r.y.x.w.w.txt == "a"