class A:
    def __init__(self, txt: str):
        self.q: E = None
        self.u: D = None
        self.w: C = None
        self.x: B = None
        self.txt = txt

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

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

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

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

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

l.q = i
l.u = d
l.w = k
l.x = c
c.s = h
k.p = l
h.q = i
h.x = i
i.p = l
d.q = i
d.x = i
assert l.x.s.q.p.q.txt == "
class A:
    def __init__(self, txt: str):
        self.q: E = None
        self.u: D = None
        self.w: C = None
        self.x: B = None
        self.txt = txt

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

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

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

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

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

l.q = i
l.u = d
l.w = k
l.x = c
c.s = h
k.p = l
h.q = i
h.x = i
i.p = l
d.q = i
d.x = i
assert l.x.s.q.p.q.txt == "i"