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

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

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

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

g.x = b
a.y = h
a.z = l
l.y = g
l.v = g
l.x = b
b.x = g
m.y = a
m.z = e
e.y = b
e.x = b
e.v = g
h.y = a
h.z = i
i.y = b
i.v = b
i.x = g
assert e.v.x.x.x.txt == "
class A:
    def __init__(self, txt: str):
        self.x: A = None
        self.txt = txt

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

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

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

g.x = b
a.y = h
a.z = l
l.y = g
l.v = g
l.x = b
b.x = g
m.y = a
m.z = e
e.y = b
e.x = b
e.v = g
h.y = a
h.z = i
i.y = b
i.v = b
i.x = g
assert e.v.x.x.x.txt == "b"