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

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

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

e = A("e")
g = B("g")
h = C("h")
l = C("l")

e.z = g
e.x = g
g.s = e
g.y = e
g.o = e
h.v = g
l.v = g
assert g.y.z.s.x.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.x: B = None
        self.txt = txt

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

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

e = A("e")
g = B("g")
h = C("h")
l = C("l")

e.z = g
e.x = g
g.s = e
g.y = e
g.o = e
h.v = g
l.v = g
assert g.y.z.s.x.txt == "g"