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

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

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

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

l = A("l")
c = B("c")
i = C("i")
g = D("g")
n = D("n")
j = C("j")
k = A("k")

l.y = c
l.z = c
l.o = k
c.o = k
i.s = n
i.p = n
i.z = l
g.p = c
g.o = k
n.p = c
n.o = k
j.s = g
j.z = k
j.p = n
k.y = c
k.z = c
k.o = l
assert j.p.o.o.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.o: A = None
        self.z: B = None
        self.txt = txt

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

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

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

l = A("l")
c = B("c")
i = C("i")
g = D("g")
n = D("n")
j = C("j")
k = A("k")

l.y = c
l.z = c
l.o = k
c.o = k
i.s = n
i.p = n
i.z = l
g.p = c
g.o = k
n.p = c
n.o = k
j.s = g
j.z = k
j.p = n
k.y = c
k.z = c
k.o = l
assert j.p.o.o.txt == "l"