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

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

class C:
    def __init__(self, txt: str):
        self.q: A = None
        self.r: B = None
        self.txt = txt

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

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

g = A("g")
n = B("n")
b = C("b")
c = D("c")
j = E("j")
f = B("f")

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

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

class C:
    def __init__(self, txt: str):
        self.q: A = None
        self.r: B = None
        self.txt = txt

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

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

g = A("g")
n = B("n")
b = C("b")
c = D("c")
j = E("j")
f = B("f")

g.v = j
g.s = c
g.p = b
n.o = g
n.x = g
n.v = j
b.q = g
b.r = f
c.u = b
c.v = g
j.z = f
j.u = c
j.t = c
j.y = c
j.w = c
f.o = g
f.x = g
f.v = j
assert n.o.s.u.q.v.txt == "j"