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

class B:
    def __init__(self, txt: str):
        self.r: B = None
        self.z: B = None
        self.x: E = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.o: B = None
        self.x: D = None
        self.s: A = None
        self.txt = txt

g = A("g")
n = B("n")
a = C("a")
c = D("c")
f = E("f")
i = B("i")

g.t = f
n.r = i
n.z = i
n.x = f
a.v = f
a.w = g
c.y = a
c.t = a
c.v = a
f.o = i
f.x = c
f.s = g
i.r = n
i.z = n
i.x = f
assert a.w.t.x.y.w.txt == "
class A:
    def __init__(self, txt: str):
        self.t: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.r: B = None
        self.z: B = None
        self.x: E = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.o: B = None
        self.x: D = None
        self.s: A = None
        self.txt = txt

g = A("g")
n = B("n")
a = C("a")
c = D("c")
f = E("f")
i = B("i")

g.t = f
n.r = i
n.z = i
n.x = f
a.v = f
a.w = g
c.y = a
c.t = a
c.v = a
f.o = i
f.x = c
f.s = g
i.r = n
i.z = n
i.x = f
assert a.w.t.x.y.w.txt == "g"