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

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

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

c = A("c")
m = B("m")
g = C("g")
k = C("k")
e = A("e")
n = B("n")
j = B("j")
f = C("f")

c.v = n
m.q = e
g.o = m
g.t = f
k.o = n
k.t = f
e.v = n
n.q = e
j.q = e
f.o = m
f.t = g
assert j.q.v.q.v.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.txt = txt

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

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

c = A("c")
m = B("m")
g = C("g")
k = C("k")
e = A("e")
n = B("n")
j = B("j")
f = C("f")

c.v = n
m.q = e
g.o = m
g.t = f
k.o = n
k.t = f
e.v = n
n.q = e
j.q = e
f.o = m
f.t = g
assert j.q.v.q.v.txt == "n"