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

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

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

class D:
    def __init__(self, txt: str):
        self.z: C = None
        self.q: B = None
        self.x: A = None
        self.v: A = None
        self.o: E = None
        self.txt = txt

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

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.z: C = None
        self.q: B = None
        self.x: A = None
        self.v: A = None
        self.o: E = None
        self.txt = txt

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

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

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