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

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

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

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

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

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

g.q = e
b.q = c
b.z = n
b.o = e
b.v = i
b.u = i
i.w = b
i.y = c
n.w = i
n.p = i
e.s = i
e.o = n
j.q = e
c.q = b
c.z = n
c.o = e
c.v = i
c.u = i
assert b.v.w.o.s.txt == "
class A:
    def __init__(self, txt: str):
        self.q: E = None
        self.txt = txt

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

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

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

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

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

g.q = e
b.q = c
b.z = n
b.o = e
b.v = i
b.u = i
i.w = b
i.y = c
n.w = i
n.p = i
e.s = i
e.o = n
j.q = e
c.q = b
c.z = n
c.o = e
c.v = i
c.u = i
assert b.v.w.o.s.txt == "i"