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

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

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

c = A("c")
g = B("g")
h = C("h")
a = C("a")
j = B("j")
i = C("i")
l = A("l")
m = A("m")
n = B("n")
f = A("f")

c.v = g
c.x = f
g.r = m
g.p = c
h.y = a
h.v = n
h.w = j
a.y = i
a.v = g
a.w = g
j.r = l
j.p = f
i.y = a
i.v = g
i.w = g
l.v = g
l.x = f
m.v = g
m.x = l
n.r = c
n.p = m
f.v = j
f.x = m
assert n.p.v.r.v.r.x.x.x.x.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.x: A = None
        self.txt = txt

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

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

c = A("c")
g = B("g")
h = C("h")
a = C("a")
j = B("j")
i = C("i")
l = A("l")
m = A("m")
n = B("n")
f = A("f")

c.v = g
c.x = f
g.r = m
g.p = c
h.y = a
h.v = n
h.w = j
a.y = i
a.v = g
a.w = g
j.r = l
j.p = f
i.y = a
i.v = g
i.w = g
l.v = g
l.x = f
m.v = g
m.x = l
n.r = c
n.p = m
f.v = j
f.x = m
assert n.p.v.r.v.r.x.x.x.x.txt == "l"