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

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

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

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

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

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

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

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

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

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

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

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

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