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

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

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

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

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

l = A("l")
h = B("h")
e = C("e")
b = D("b")
g = E("g")

l.y = h
h.q = g
e.w = l
e.p = b
e.s = b
e.t = b
e.u = h
b.r = g
g.w = h
assert e.w.y.q.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.txt = txt

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

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

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

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

l = A("l")
h = B("h")
e = C("e")
b = D("b")
g = E("g")

l.y = h
h.q = g
e.w = l
e.p = b
e.s = b
e.t = b
e.u = h
b.r = g
g.w = h
assert e.w.y.q.txt == "g"