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

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

class C:
    def __init__(self, txt: str):
        self.u: E = None
        self.v: E = None
        self.y: E = None
        self.r: A = None
        self.x: E = None
        self.txt = txt

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

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

b = A("b")
g = B("g")
l = C("l")
m = D("m")
d = E("d")

b.s = g
b.p = g
b.w = l
g.t = d
l.u = d
l.v = d
l.y = d
l.x = d
l.r = b
m.v = l
m.o = l
d.y = l
assert l.v.y.v.y.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.p: B = None
        self.w: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.u: E = None
        self.v: E = None
        self.y: E = None
        self.r: A = None
        self.x: E = None
        self.txt = txt

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

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

b = A("b")
g = B("g")
l = C("l")
m = D("m")
d = E("d")

b.s = g
b.p = g
b.w = l
g.t = d
l.u = d
l.v = d
l.y = d
l.x = d
l.r = b
m.v = l
m.o = l
d.y = l
assert l.v.y.v.y.txt == "l"