class A:
    def __init__(self, txt: str):
        self.s: E = 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.u: B = None
        self.txt = txt

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

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

c = A("c")
l = B("l")
g = C("g")
k = D("k")
n = E("n")
m = E("m")
h = A("h")
f = B("f")
b = D("b")

c.s = n
l.z = k
g.u = f
k.z = m
k.v = f
k.x = l
n.p = h
m.p = h
h.s = n
f.z = k
b.z = n
b.v = l
b.x = l
assert l.z.z.p.s.p.s.txt == "
class A:
    def __init__(self, txt: str):
        self.s: E = 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.u: B = None
        self.txt = txt

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

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

c = A("c")
l = B("l")
g = C("g")
k = D("k")
n = E("n")
m = E("m")
h = A("h")
f = B("f")
b = D("b")

c.s = n
l.z = k
g.u = f
k.z = m
k.v = f
k.x = l
n.p = h
m.p = h
h.s = n
f.z = k
b.z = n
b.v = l
b.x = l
assert l.z.z.p.s.p.s.txt == "n"