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

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

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

i = A("i")
b = B("b")
m = C("m")
f = B("f")
j = B("j")
d = C("d")
c = A("c")
a = C("a")
n = A("n")
k = C("k")

i.v = f
i.q = f
i.x = n
b.o = i
m.v = c
m.s = f
m.x = b
f.o = n
j.o = i
d.v = i
d.s = j
d.x = b
c.v = f
c.q = f
c.x = i
a.v = i
a.s = f
a.x = f
n.v = j
n.x = c
n.q = f
k.v = i
k.s = j
k.x = j
assert c.q.o.x.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.x: A = None
        self.q: B = None
        self.txt = txt

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

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

i = A("i")
b = B("b")
m = C("m")
f = B("f")
j = B("j")
d = C("d")
c = A("c")
a = C("a")
n = A("n")
k = C("k")

i.v = f
i.q = f
i.x = n
b.o = i
m.v = c
m.s = f
m.x = b
f.o = n
j.o = i
d.v = i
d.s = j
d.x = b
c.v = f
c.q = f
c.x = i
a.v = i
a.s = f
a.x = f
n.v = j
n.x = c
n.q = f
k.v = i
k.s = j
k.x = j
assert c.q.o.x.txt == "c"