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

class B:
    def __init__(self, txt: str):
        self.z: D = None
        self.q: A = None
        self.o: D = None
        self.w: D = None
        self.txt = txt

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

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

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

g = A("g")
f = B("f")
e = C("e")
c = D("c")
n = E("n")
a = A("a")
b = B("b")
h = A("h")

g.v = c
g.w = c
g.s = b
g.p = f
f.z = c
f.o = c
f.w = c
f.q = h
e.s = c
e.p = n
c.u = g
n.u = f
n.r = f
n.o = e
n.q = e
a.v = c
a.w = c
a.s = b
a.p = b
b.z = c
b.o = c
b.w = c
b.q = h
h.v = c
h.w = c
h.s = b
h.p = f
assert n.o.s.u.txt == "
class A:
    def __init__(self, txt: str):
        self.v: D = None
        self.s: B = None
        self.p: B = None
        self.w: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.z: D = None
        self.q: A = None
        self.o: D = None
        self.w: D = None
        self.txt = txt

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

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

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

g = A("g")
f = B("f")
e = C("e")
c = D("c")
n = E("n")
a = A("a")
b = B("b")
h = A("h")

g.v = c
g.w = c
g.s = b
g.p = f
f.z = c
f.o = c
f.w = c
f.q = h
e.s = c
e.p = n
c.u = g
n.u = f
n.r = f
n.o = e
n.q = e
a.v = c
a.w = c
a.s = b
a.p = b
b.z = c
b.o = c
b.w = c
b.q = h
h.v = c
h.w = c
h.s = b
h.p = f
assert n.o.s.u.txt == "g"