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

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

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

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

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

l.o = g
l.z = c
i.p = n
i.s = g
i.v = e
i.w = e
a.o = e
e.r = a
e.y = j
e.p = g
c.o = g
c.z = g
g.o = c
g.z = c
n.p = i
n.s = l
n.v = e
n.w = e
j.o = l
j.z = g
assert a.o.r.o.y.o.o.txt == "
class A:
    def __init__(self, txt: str):
        self.o: A = None
        self.z: A = None
        self.txt = txt

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

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

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

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

l.o = g
l.z = c
i.p = n
i.s = g
i.v = e
i.w = e
a.o = e
e.r = a
e.y = j
e.p = g
c.o = g
c.z = g
g.o = c
g.z = c
n.p = i
n.s = l
n.v = e
n.w = e
j.o = l
j.z = g
assert a.o.r.o.y.o.o.txt == "g"