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

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

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

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

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

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

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

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

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

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

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