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

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

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

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

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

f = A("f")
c = B("c")
k = C("k")
n = D("n")
g = E("g")
d = B("d")
e = D("e")

f.u = g
f.w = n
c.s = f
c.u = f
c.y = g
c.z = k
k.o = f
n.w = d
n.t = g
n.v = g
g.q = f
g.u = f
g.v = f
g.t = c
g.z = k
d.s = f
d.u = f
d.y = g
d.z = k
e.w = d
e.t = g
e.v = g
assert k.o.w.w.s.txt == "
class A:
    def __init__(self, txt: str):
        self.u: E = None
        self.w: D = None
        self.txt = txt

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

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

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

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

f = A("f")
c = B("c")
k = C("k")
n = D("n")
g = E("g")
d = B("d")
e = D("e")

f.u = g
f.w = n
c.s = f
c.u = f
c.y = g
c.z = k
k.o = f
n.w = d
n.t = g
n.v = g
g.q = f
g.u = f
g.v = f
g.t = c
g.z = k
d.s = f
d.u = f
d.y = g
d.z = k
e.w = d
e.t = g
e.v = g
assert k.o.w.w.s.txt == "f"