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

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

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

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

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

k = A("k")
j = B("j")
e = C("e")
h = D("h")
f = E("f")
m = E("m")
l = E("l")
g = B("g")

k.q = l
j.v = h
j.r = k
j.q = k
j.x = e
e.o = j
e.y = g
e.x = h
h.y = j
h.o = e
f.y = k
f.x = j
f.t = e
f.q = e
f.v = h
m.y = k
m.x = g
m.t = e
m.q = e
m.v = h
l.y = k
l.x = g
l.t = e
l.q = e
l.v = h
g.v = h
g.r = k
g.q = k
g.x = e
assert g.x.y.v.o.o.q.q.y.txt == "
class A:
    def __init__(self, txt: str):
        self.q: E = None
        self.txt = txt

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

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

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

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

k = A("k")
j = B("j")
e = C("e")
h = D("h")
f = E("f")
m = E("m")
l = E("l")
g = B("g")

k.q = l
j.v = h
j.r = k
j.q = k
j.x = e
e.o = j
e.y = g
e.x = h
h.y = j
h.o = e
f.y = k
f.x = j
f.t = e
f.q = e
f.v = h
m.y = k
m.x = g
m.t = e
m.q = e
m.v = h
l.y = k
l.x = g
l.t = e
l.q = e
l.v = h
g.v = h
g.r = k
g.q = k
g.x = e
assert g.x.y.v.o.o.q.q.y.txt == "k"