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

class B:
    def __init__(self, txt: str):
        self.t: B = None
        self.s: A = None
        self.txt = txt

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

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

a.p = m
a.r = g
a.o = g
d.t = i
d.s = c
g.v = c
g.q = l
m.t = i
m.s = j
l.t = i
l.s = c
j.p = d
j.r = f
j.o = f
f.v = j
f.q = l
c.p = l
c.r = g
c.o = g
n.p = i
n.r = g
n.o = f
i.t = d
i.s = n
assert n.o.q.t.s.txt == "
class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.r: C = None
        self.o: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: B = None
        self.s: A = None
        self.txt = txt

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

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

a.p = m
a.r = g
a.o = g
d.t = i
d.s = c
g.v = c
g.q = l
m.t = i
m.s = j
l.t = i
l.s = c
j.p = d
j.r = f
j.o = f
f.v = j
f.q = l
c.p = l
c.r = g
c.o = g
n.p = i
n.r = g
n.o = f
i.t = d
i.s = n
assert n.o.q.t.s.txt == "n"