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

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

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

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

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

a = A("a")
e = B("e")
d = C("d")
c = D("c")
l = E("l")
j = E("j")

a.s = e
a.x = c
a.y = c
e.u = d
d.u = c
d.q = c
d.t = e
c.t = a
c.w = l
c.v = d
l.q = j
j.q = l
assert a.y.t.s.u.t.u.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.x: D = None
        self.y: D = None
        self.txt = txt

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

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

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

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

a = A("a")
e = B("e")
d = C("d")
c = D("c")
l = E("l")
j = E("j")

a.s = e
a.x = c
a.y = c
e.u = d
d.u = c
d.q = c
d.t = e
c.t = a
c.w = l
c.v = d
l.q = j
j.q = l
assert a.y.t.s.u.t.u.txt == "d"