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

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

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

m = A("m")
f = B("f")
a = C("a")
b = C("b")
n = B("n")
h = B("h")
l = B("l")
i = A("i")
g = A("g")

m.z = a
m.p = i
f.t = l
f.v = l
f.o = b
a.y = g
a.t = b
b.y = g
b.t = a
n.t = h
n.o = a
n.v = l
h.t = f
h.o = b
h.v = n
l.t = h
l.v = h
l.o = b
i.z = a
i.p = g
g.z = a
g.p = i
assert a.t.t.t.t.txt == "
class A:
    def __init__(self, txt: str):
        self.z: C = None
        self.p: A = None
        self.txt = txt

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

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

m = A("m")
f = B("f")
a = C("a")
b = C("b")
n = B("n")
h = B("h")
l = B("l")
i = A("i")
g = A("g")

m.z = a
m.p = i
f.t = l
f.v = l
f.o = b
a.y = g
a.t = b
b.y = g
b.t = a
n.t = h
n.o = a
n.v = l
h.t = f
h.o = b
h.v = n
l.t = h
l.v = h
l.o = b
i.z = a
i.p = g
g.z = a
g.p = i
assert a.t.t.t.t.txt == "a"