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

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

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

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

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

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

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

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

f.q = h
f.p = l
f.u = l
h.t = d
h.x = d
h.w = n
n.r = k
n.w = h
n.v = f
k.q = c
k.p = l
k.u = l
d.t = h
d.x = h
d.w = l
m.r = f
m.w = b
m.v = k
b.t = h
b.x = c
b.w = i
l.r = k
l.w = h
l.v = f
i.r = f
i.w = b
i.v = k
c.t = b
c.x = d
c.w = n
assert l.r.u.w.w.r.txt == "k"