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

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

class C:
    def __init__(self, txt: str):
        self.q: D = None
        self.u: F = None
        self.t: F = None
        self.s: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.x: A = None
        self.w: F = None
        self.o: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.u: E = None
        self.r: D = None
        self.s: F = None
        self.o: E = None
        self.v: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.s: B = None
        self.u: C = None
        self.txt = txt

i = A("i")
l = B("l")
k = C("k")
b = D("b")
m = E("m")
f = F("f")
a = A("a")
c = E("c")
g = C("g")

i.q = m
i.u = k
i.x = g
l.s = f
l.o = f
l.w = f
l.p = k
l.y = a
l.x = i
k.q = b
k.u = f
k.t = f
k.s = c
b.x = a
b.w = f
b.o = l
m.u = c
m.o = c
m.r = b
m.v = b
m.s = f
f.s = l
f.u = g
a.q = m
a.u = k
a.x = k
c.u = m
c.o = m
c.r = b
c.v = b
c.s = f
g.q = b
g.u = f
g.t = f
g.s = m
assert g.q.x.q.txt == "
class A:
    def __init__(self, txt: str):
        self.q: E = None
        self.u: C = None
        self.x: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.q: D = None
        self.u: F = None
        self.t: F = None
        self.s: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.x: A = None
        self.w: F = None
        self.o: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.u: E = None
        self.r: D = None
        self.s: F = None
        self.o: E = None
        self.v: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.s: B = None
        self.u: C = None
        self.txt = txt

i = A("i")
l = B("l")
k = C("k")
b = D("b")
m = E("m")
f = F("f")
a = A("a")
c = E("c")
g = C("g")

i.q = m
i.u = k
i.x = g
l.s = f
l.o = f
l.w = f
l.p = k
l.y = a
l.x = i
k.q = b
k.u = f
k.t = f
k.s = c
b.x = a
b.w = f
b.o = l
m.u = c
m.o = c
m.r = b
m.v = b
m.s = f
f.s = l
f.u = g
a.q = m
a.u = k
a.x = k
c.u = m
c.o = m
c.r = b
c.v = b
c.s = f
g.q = b
g.u = f
g.t = f
g.s = m
assert g.q.x.q.txt == "m"