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

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

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

class D:
    def __init__(self, txt: str):
        self.o: A = None
        self.p: C = None
        self.v: A = None
        self.w: B = None
        self.y: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.z: A = None
        self.y: A = None
        self.q: B = None
        self.s: C = None
        self.r: D = None
        self.txt = txt

b = A("b")
m = B("m")
c = C("c")
e = D("e")
f = E("f")
l = A("l")
g = A("g")

b.p = m
m.w = c
c.r = b
c.t = e
c.x = g
c.y = f
e.o = b
e.p = c
e.v = l
e.w = m
e.y = m
f.z = g
f.y = l
f.q = m
f.s = c
f.r = e
l.p = m
g.p = m
assert b.p.w.y.y.txt == "
class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.o: A = None
        self.p: C = None
        self.v: A = None
        self.w: B = None
        self.y: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.z: A = None
        self.y: A = None
        self.q: B = None
        self.s: C = None
        self.r: D = None
        self.txt = txt

b = A("b")
m = B("m")
c = C("c")
e = D("e")
f = E("f")
l = A("l")
g = A("g")

b.p = m
m.w = c
c.r = b
c.t = e
c.x = g
c.y = f
e.o = b
e.p = c
e.v = l
e.w = m
e.y = m
f.z = g
f.y = l
f.q = m
f.s = c
f.r = e
l.p = m
g.p = m
assert b.p.w.y.y.txt == "l"