class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.x: E = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.z: A = None
        self.t: C = None
        self.txt = txt

l = A("l")
d = B("d")
k = C("k")
h = D("h")
a = E("a")
i = C("i")

l.s = i
l.x = a
d.w = l
d.p = h
k.v = h
k.z = h
k.p = h
k.q = h
k.x = d
h.y = a
a.z = l
a.t = k
i.v = h
i.z = h
i.p = h
i.q = h
i.x = d
assert k.p.y.z.s.txt == "
class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.x: E = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.z: A = None
        self.t: C = None
        self.txt = txt

l = A("l")
d = B("d")
k = C("k")
h = D("h")
a = E("a")
i = C("i")

l.s = i
l.x = a
d.w = l
d.p = h
k.v = h
k.z = h
k.p = h
k.q = h
k.x = d
h.y = a
a.z = l
a.t = k
i.v = h
i.z = h
i.p = h
i.q = h
i.x = d
assert k.p.y.z.s.txt == "i"