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

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

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

class D:
    def __init__(self, txt: str):
        self.x: E = None
        self.p: E = None
        self.q: A = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.v: A = None
        self.o: C = None
        self.r: C = None
        self.t: A = None
        self.q: C = None
        self.txt = txt

j = A("j")
f = B("f")
n = C("n")
g = D("g")
e = E("e")
h = B("h")

j.u = e
j.v = g
j.t = n
f.r = j
f.w = j
f.v = g
f.o = g
f.u = n
n.z = f
n.w = f
g.x = e
g.p = e
g.q = j
e.v = j
e.t = j
e.o = n
e.r = n
e.q = n
h.r = j
h.w = j
h.v = g
h.o = g
h.u = n
assert e.o.z.u.z.u.w.txt == "
class A:
    def __init__(self, txt: str):
        self.u: E = None
        self.v: D = None
        self.t: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.x: E = None
        self.p: E = None
        self.q: A = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.v: A = None
        self.o: C = None
        self.r: C = None
        self.t: A = None
        self.q: C = None
        self.txt = txt

j = A("j")
f = B("f")
n = C("n")
g = D("g")
e = E("e")
h = B("h")

j.u = e
j.v = g
j.t = n
f.r = j
f.w = j
f.v = g
f.o = g
f.u = n
n.z = f
n.w = f
g.x = e
g.p = e
g.q = j
e.v = j
e.t = j
e.o = n
e.r = n
e.q = n
h.r = j
h.w = j
h.v = g
h.o = g
h.u = n
assert e.o.z.u.z.u.w.txt == "f"