class A:
    def __init__(self, txt: str):
        self.v: D = None
        self.y: E = None
        self.s: B = None
        self.u: E = None
        self.txt = txt

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

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

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

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

i = A("i")
k = B("k")
n = C("n")
g = D("g")
f = E("f")
b = C("b")

i.v = g
i.y = f
i.u = f
i.s = k
k.x = i
k.q = g
k.p = b
n.v = k
n.t = g
n.z = f
g.x = f
f.y = i
f.q = k
b.v = k
b.t = g
b.z = f
assert g.x.y.u.q.q.txt == "
class A:
    def __init__(self, txt: str):
        self.v: D = None
        self.y: E = None
        self.s: B = None
        self.u: E = None
        self.txt = txt

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

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

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

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

i = A("i")
k = B("k")
n = C("n")
g = D("g")
f = E("f")
b = C("b")

i.v = g
i.y = f
i.u = f
i.s = k
k.x = i
k.q = g
k.p = b
n.v = k
n.t = g
n.z = f
g.x = f
f.y = i
f.q = k
b.v = k
b.t = g
b.z = f
assert g.x.y.u.q.q.txt == "g"