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

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

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

i = A("i")
h = B("h")
c = C("c")
g = C("g")
d = A("d")
j = B("j")
n = A("n")

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

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

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

i = A("i")
h = B("h")
c = C("c")
g = C("g")
d = A("d")
j = B("j")
n = A("n")

i.q = c
i.x = j
i.o = d
h.v = j
h.z = j
c.t = g
g.t = c
d.q = c
d.x = j
d.o = i
j.v = h
j.z = h
n.q = g
n.x = j
n.o = d
assert h.z.v.z.v.z.v.z.txt == "j"