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

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

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

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

j.r = h
j.u = a
h.q = n
h.o = j
h.p = a
n.x = e
n.v = a
k.q = a
k.p = a
k.o = j
c.r = h
c.u = a
a.x = j
a.v = n
e.r = k
e.u = n
l.r = k
l.u = n
d.q = n
d.o = c
d.p = a
assert j.r.o.r.q.v.v.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.u: C = None
        self.txt = txt

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

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

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

j.r = h
j.u = a
h.q = n
h.o = j
h.p = a
n.x = e
n.v = a
k.q = a
k.p = a
k.o = j
c.r = h
c.u = a
a.x = j
a.v = n
e.r = k
e.u = n
l.r = k
l.u = n
d.q = n
d.o = c
d.p = a
assert j.r.o.r.q.v.v.txt == "n"