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

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

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

g = A("g")
h = B("h")
n = C("n")
f = A("f")
l = B("l")
c = A("c")
e = C("e")

g.t = c
g.z = l
h.v = n
h.w = l
n.x = f
n.o = e
f.t = c
f.z = h
l.v = n
l.w = h
c.t = g
c.z = h
e.x = g
e.o = n
assert c.t.t.z.v.x.z.txt == "
class A:
    def __init__(self, txt: str):
        self.t: A = None
        self.z: B = None
        self.txt = txt

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

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

g = A("g")
h = B("h")
n = C("n")
f = A("f")
l = B("l")
c = A("c")
e = C("e")

g.t = c
g.z = l
h.v = n
h.w = l
n.x = f
n.o = e
f.t = c
f.z = h
l.v = n
l.w = h
c.t = g
c.z = h
e.x = g
e.o = n
assert c.t.t.z.v.x.z.txt == "h"