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

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

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

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

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

l.s = k
g.o = e
g.q = k
g.t = j
g.y = n
i.v = g
k.x = e
k.z = e
k.r = i
k.p = b
j.v = g
e.v = g
b.s = c
c.x = i
c.r = j
c.z = j
c.p = l
n.x = e
n.r = e
n.z = e
n.p = b
assert l.s.z.v.q.p.s.p.txt == "
class A:
    def __init__(self, txt: str):
        self.s: D = None
        self.txt = txt

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

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

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

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

l.s = k
g.o = e
g.q = k
g.t = j
g.y = n
i.v = g
k.x = e
k.z = e
k.r = i
k.p = b
j.v = g
e.v = g
b.s = c
c.x = i
c.r = j
c.z = j
c.p = l
n.x = e
n.r = e
n.z = e
n.p = b
assert l.s.z.v.q.p.s.p.txt == "l"