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

class B:
    def __init__(self, txt: str):
        self.v: C = None
        self.r: A = None
        self.o: E = None
        self.z: E = None
        self.txt = txt

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

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.v: C = None
        self.r: A = None
        self.o: E = None
        self.z: E = None
        self.txt = txt

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

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

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

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

b.q = d
b.u = n
f.v = i
f.r = e
f.o = n
f.z = n
i.o = b
c.y = g
c.w = f
c.q = f
c.o = i
c.p = a
d.x = i
n.x = i
g.q = d
g.u = n
a.y = g
a.w = f
a.q = f
a.o = i
a.p = c
e.q = d
e.u = n
assert i.o.q.x.o.q.x.txt == "i"