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

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

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

b = A("b")
m = B("m")
l = C("l")
d = C("d")
e = C("e")
f = B("f")
c = C("c")
n = B("n")

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

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

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

b = A("b")
m = B("m")
l = C("l")
d = C("d")
e = C("e")
f = B("f")
c = C("c")
n = B("n")

b.y = c
b.r = d
m.v = l
l.w = f
l.y = f
l.r = b
d.w = f
d.r = b
d.y = n
e.w = n
e.r = b
e.y = m
f.v = d
c.w = n
c.y = n
c.r = b
n.v = d
assert n.v.w.v.y.v.y.v.r.txt == "b"