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

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

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

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

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

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

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

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

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

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

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

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

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