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

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

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

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

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

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

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

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

g.t = e
g.v = a
g.q = c
f.v = n
f.x = a
i.y = j
i.o = c
i.z = g
a.v = f
a.x = m
m.v = e
m.x = n
c.y = j
c.z = j
c.o = i
n.v = a
n.x = e
j.t = m
j.v = e
j.q = i
e.v = f
e.x = m
assert a.x.x.v.txt == "a"