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

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

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

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

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

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

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

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

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