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

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

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

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

class E:
    def __init__(self, txt: str):
        self.v: A = None
        self.p: A = None
        self.t: B = None
        self.w: B = None
        self.u: B = None
        self.txt = txt

l = A("l")
a = B("a")
f = C("f")
b = D("b")
d = E("d")

l.q = b
l.y = f
a.y = b
f.u = l
f.y = b
b.o = d
b.v = d
d.v = l
d.p = l
d.t = a
d.w = a
d.u = a
assert f.y.o.u.txt == "
class A:
    def __init__(self, txt: str):
        self.q: D = None
        self.y: C = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.v: A = None
        self.p: A = None
        self.t: B = None
        self.w: B = None
        self.u: B = None
        self.txt = txt

l = A("l")
a = B("a")
f = C("f")
b = D("b")
d = E("d")

l.q = b
l.y = f
a.y = b
f.u = l
f.y = b
b.o = d
b.v = d
d.v = l
d.p = l
d.t = a
d.w = a
d.u = a
assert f.y.o.u.txt == "a"