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

class B:
    def __init__(self, txt: str):
        self.y: A = None
        self.t: 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.p: A = None
        self.txt = txt

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

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

c.u = d
c.q = d
c.y = l
i.y = c
i.t = l
d.u = i
l.p = c
n.p = c
n.w = c
n.q = d
assert c.u.u.t.p.txt == "
class A:
    def __init__(self, txt: str):
        self.u: C = None
        self.q: C = None
        self.y: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: A = None
        self.t: 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.p: A = None
        self.txt = txt

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

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

c.u = d
c.q = d
c.y = l
i.y = c
i.t = l
d.u = i
l.p = c
n.p = c
n.w = c
n.q = d
assert c.u.u.t.p.txt == "c"