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

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

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

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

e = A("e")
k = B("k")
b = C("b")
l = D("l")
c = D("c")
d = C("d")
i = A("i")
g = C("g")

e.y = l
k.z = c
b.o = c
b.y = k
l.v = e
l.y = k
l.x = k
c.v = i
c.y = k
c.x = k
d.o = c
d.y = k
i.y = c
g.o = c
g.y = k
assert b.y.z.x.z.x.txt == "
class A:
    def __init__(self, txt: str):
        self.y: D = None
        self.txt = txt

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

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

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

e = A("e")
k = B("k")
b = C("b")
l = D("l")
c = D("c")
d = C("d")
i = A("i")
g = C("g")

e.y = l
k.z = c
b.o = c
b.y = k
l.v = e
l.y = k
l.x = k
c.v = i
c.y = k
c.x = k
d.o = c
d.y = k
i.y = c
g.o = c
g.y = k
assert b.y.z.x.z.x.txt == "k"