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

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

i = A("i")
l = B("l")
a = A("a")
c = B("c")
d = B("d")
g = A("g")

i.v = c
i.o = d
l.p = g
l.z = c
a.v = l
a.o = c
c.p = a
c.z = l
d.p = g
d.z = l
g.v = d
g.o = d
assert d.z.p.v.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.o: B = None
        self.txt = txt

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

i = A("i")
l = B("l")
a = A("a")
c = B("c")
d = B("d")
g = A("g")

i.v = c
i.o = d
l.p = g
l.z = c
a.v = l
a.o = c
c.p = a
c.z = l
d.p = g
d.z = l
g.v = d
g.o = d
assert d.z.p.v.txt == "d"