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

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

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

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

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

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

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

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

l.u = k
l.r = a
n.v = k
n.s = a
n.x = l
h.x = d
h.w = k
h.q = b
k.u = l
k.r = b
d.x = f
d.w = k
d.q = b
j.x = f
j.w = k
j.q = b
a.v = l
a.x = l
a.s = n
b.v = k
b.x = k
b.s = a
f.x = d
f.w = k
f.q = a
assert l.u.r.s.v.r.txt == "a"