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

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

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

n = A("n")
i = B("i")
e = C("e")
d = A("d")
j = C("j")
h = A("h")
a = B("a")
g = B("g")
k = A("k")
l = B("l")

n.p = k
n.y = l
i.r = k
i.x = a
i.p = d
e.q = j
e.t = j
e.v = l
d.p = n
d.y = a
j.q = e
j.t = e
j.v = g
h.p = n
h.y = a
a.r = d
a.p = d
a.x = l
g.r = k
g.x = a
g.p = h
k.p = h
k.y = g
l.r = h
l.p = h
l.x = i
assert i.p.y.r.y.r.p.txt == "
class A:
    def __init__(self, txt: str):
        self.p: A = None
        self.y: B = None
        self.txt = txt

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

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

n = A("n")
i = B("i")
e = C("e")
d = A("d")
j = C("j")
h = A("h")
a = B("a")
g = B("g")
k = A("k")
l = B("l")

n.p = k
n.y = l
i.r = k
i.x = a
i.p = d
e.q = j
e.t = j
e.v = l
d.p = n
d.y = a
j.q = e
j.t = e
j.v = g
h.p = n
h.y = a
a.r = d
a.p = d
a.x = l
g.r = k
g.x = a
g.p = h
k.p = h
k.y = g
l.r = h
l.p = h
l.x = i
assert i.p.y.r.y.r.p.txt == "n"