class A:
    def __init__(self, txt: str):
        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.o: C = None
        self.u: D = None
        self.y: B = None
        self.w: D = None
        self.txt = txt

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

b = A("b")
j = B("j")
m = C("m")
l = D("l")
k = B("k")
d = B("d")
n = B("n")
i = B("i")
c = C("c")
f = D("f")

b.r = m
j.v = m
m.o = c
m.u = l
m.w = l
m.y = i
l.t = c
l.s = b
k.v = c
d.v = c
n.v = m
i.v = m
c.o = m
c.u = f
c.y = n
c.w = l
f.t = c
f.s = b
assert k.v.y.v.y.v.w.s.r.txt == "
class A:
    def __init__(self, txt: str):
        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.o: C = None
        self.u: D = None
        self.y: B = None
        self.w: D = None
        self.txt = txt

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

b = A("b")
j = B("j")
m = C("m")
l = D("l")
k = B("k")
d = B("d")
n = B("n")
i = B("i")
c = C("c")
f = D("f")

b.r = m
j.v = m
m.o = c
m.u = l
m.w = l
m.y = i
l.t = c
l.s = b
k.v = c
d.v = c
n.v = m
i.v = m
c.o = m
c.u = f
c.y = n
c.w = l
f.t = c
f.s = b
assert k.v.y.v.y.v.w.s.r.txt == "m"