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

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

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

l = A("l")
d = B("d")
b = C("b")
c = A("c")
n = C("n")
f = C("f")
i = C("i")
a = A("a")
j = B("j")

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

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

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

l = A("l")
d = B("d")
b = C("b")
c = A("c")
n = C("n")
f = C("f")
i = C("i")
a = A("a")
j = B("j")

l.u = n
d.x = j
d.v = f
d.r = i
b.y = f
b.u = i
b.v = a
c.u = n
n.y = b
n.u = f
n.v = l
f.y = b
f.u = b
f.v = l
i.y = n
i.u = f
i.v = c
a.u = n
j.x = d
j.v = i
j.r = b
assert c.u.v.u.v.u.txt == "n"