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

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

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

d = A("d")
b = B("b")
g = C("g")
k = B("k")
f = C("f")
n = A("n")
m = A("m")
i = B("i")
l = C("l")
a = B("a")

d.r = a
d.w = f
d.y = g
b.u = a
b.p = g
g.u = n
g.v = f
k.u = b
k.p = l
f.u = n
f.v = l
n.r = i
n.w = f
n.y = l
m.r = i
m.w = g
m.y = g
i.u = a
i.p = g
l.u = m
l.v = g
a.u = k
a.p = l
assert k.p.u.y.v.v.u.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.w: C = None
        self.y: C = None
        self.txt = txt

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

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

d = A("d")
b = B("b")
g = C("g")
k = B("k")
f = C("f")
n = A("n")
m = A("m")
i = B("i")
l = C("l")
a = B("a")

d.r = a
d.w = f
d.y = g
b.u = a
b.p = g
g.u = n
g.v = f
k.u = b
k.p = l
f.u = n
f.v = l
n.r = i
n.w = f
n.y = l
m.r = i
m.w = g
m.y = g
i.u = a
i.p = g
l.u = m
l.v = g
a.u = k
a.p = l
assert k.p.u.y.v.v.u.txt == "m"