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

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

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

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

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

a = A("a")
c = B("c")
d = C("d")
g = D("g")
j = E("j")
k = D("k")
b = E("b")

a.v = d
c.v = g
c.z = g
d.w = k
g.r = b
g.w = b
g.y = a
g.s = d
j.o = k
j.y = k
k.r = b
k.w = b
k.y = a
k.s = d
b.o = k
b.y = k
assert b.o.s.w.s.w.s.w.txt == "
class A:
    def __init__(self, txt: str):
        self.v: C = None
        self.txt = txt

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

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

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

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

a = A("a")
c = B("c")
d = C("d")
g = D("g")
j = E("j")
k = D("k")
b = E("b")

a.v = d
c.v = g
c.z = g
d.w = k
g.r = b
g.w = b
g.y = a
g.s = d
j.o = k
j.y = k
k.r = b
k.w = b
k.y = a
k.s = d
b.o = k
b.y = k
assert b.o.s.w.s.w.s.w.txt == "k"