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

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

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

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

d.v = m
d.u = f
b.r = f
b.w = d
b.u = l
j.t = l
j.w = i
j.s = m
k.t = l
k.w = m
k.s = b
m.r = k
m.w = d
m.u = d
f.t = l
f.w = i
f.s = n
i.r = k
i.w = l
i.u = l
l.v = b
l.u = k
h.r = f
h.w = d
h.u = l
n.r = f
n.w = l
n.u = l
assert k.w.w.v.r.s.w.v.w.v.w.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.u: C = None
        self.txt = txt

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

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

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

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