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

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

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

n = A("n")
i = B("i")
b = C("b")
j = A("j")
h = A("h")
k = A("k")
m = B("m")
c = C("c")
l = A("l")

n.v = c
n.o = b
i.q = n
i.t = c
i.r = b
b.t = l
b.p = m
b.x = c
j.v = c
j.o = b
h.v = c
h.o = c
k.v = c
k.o = b
m.q = n
m.t = b
m.r = c
c.t = h
c.p = i
c.x = b
l.v = c
l.o = b
assert m.q.v.p.r.txt == "
class A:
    def __init__(self, txt: str):
        self.v: C = None
        self.o: C = None
        self.txt = txt

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

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

n = A("n")
i = B("i")
b = C("b")
j = A("j")
h = A("h")
k = A("k")
m = B("m")
c = C("c")
l = A("l")

n.v = c
n.o = b
i.q = n
i.t = c
i.r = b
b.t = l
b.p = m
b.x = c
j.v = c
j.o = b
h.v = c
h.o = c
k.v = c
k.o = b
m.q = n
m.t = b
m.r = c
c.t = h
c.p = i
c.x = b
l.v = c
l.o = b
assert m.q.v.p.r.txt == "b"