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

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

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

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

class E:
    def __init__(self, txt: str):
        self.s: A = None
        self.p: C = None
        self.x: B = None
        self.w: C = None
        self.txt = txt

g = A("g")
e = B("e")
d = C("d")
i = D("i")
f = E("f")
n = A("n")
m = B("m")

g.v = n
g.z = n
g.t = d
g.q = i
g.y = f
e.o = g
e.p = g
e.v = i
e.r = i
e.q = m
d.z = f
d.t = f
d.p = e
i.t = g
i.x = g
i.p = m
f.s = n
f.p = d
f.w = d
f.x = m
n.v = g
n.z = g
n.t = d
n.q = i
n.y = f
m.o = g
m.p = g
m.v = i
m.r = i
m.q = e
assert e.v.x.y.x.r.p.q.txt == "
class A:
    def __init__(self, txt: str):
        self.v: A = None
        self.t: C = None
        self.q: D = None
        self.y: E = None
        self.z: A = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.s: A = None
        self.p: C = None
        self.x: B = None
        self.w: C = None
        self.txt = txt

g = A("g")
e = B("e")
d = C("d")
i = D("i")
f = E("f")
n = A("n")
m = B("m")

g.v = n
g.z = n
g.t = d
g.q = i
g.y = f
e.o = g
e.p = g
e.v = i
e.r = i
e.q = m
d.z = f
d.t = f
d.p = e
i.t = g
i.x = g
i.p = m
f.s = n
f.p = d
f.w = d
f.x = m
n.v = g
n.z = g
n.t = d
n.q = i
n.y = f
m.o = g
m.p = g
m.v = i
m.r = i
m.q = e
assert e.v.x.y.x.r.p.q.txt == "e"