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

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

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

h = A("h")
k = B("k")
g = C("g")
d = C("d")
l = B("l")

h.x = l
h.o = g
h.z = k
k.s = h
k.x = h
k.t = d
g.v = h
g.u = d
g.r = d
d.v = h
d.u = g
d.r = g
l.s = h
l.x = h
l.t = g
assert d.u.v.z.s.o.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.o: C = None
        self.z: B = None
        self.txt = txt

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

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

h = A("h")
k = B("k")
g = C("g")
d = C("d")
l = B("l")

h.x = l
h.o = g
h.z = k
k.s = h
k.x = h
k.t = d
g.v = h
g.u = d
g.r = d
d.v = h
d.u = g
d.r = g
l.s = h
l.x = h
l.t = g
assert d.u.v.z.s.o.txt == "g"