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

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

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

k = A("k")
j = B("j")
e = C("e")
i = C("i")
f = C("f")
g = B("g")
h = A("h")

k.z = g
k.p = f
j.o = h
j.v = h
j.w = e
e.y = g
e.r = j
e.x = i
i.y = j
i.r = g
i.x = f
f.y = j
f.r = g
f.x = i
g.o = k
g.w = e
g.v = h
h.z = g
h.p = f
assert i.r.w.y.v.z.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.p: C = None
        self.txt = txt

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

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

k = A("k")
j = B("j")
e = C("e")
i = C("i")
f = C("f")
g = B("g")
h = A("h")

k.z = g
k.p = f
j.o = h
j.v = h
j.w = e
e.y = g
e.r = j
e.x = i
i.y = j
i.r = g
i.x = f
f.y = j
f.r = g
f.x = i
g.o = k
g.w = e
g.v = h
h.z = g
h.p = f
assert i.r.w.y.v.z.txt == "g"