class A:
    def __init__(self, txt: str):
        self.u: F = None
        self.w: A = None
        self.s: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.w: D = None
        self.q: A = None
        self.z: D = None
        self.r: F = None
        self.txt = txt

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

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

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

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

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

h.u = b
h.w = n
h.s = k
g.w = f
g.z = f
g.q = h
g.r = l
i.z = g
f.x = k
f.v = l
f.s = l
f.q = i
f.y = n
m.s = g
m.p = i
b.p = g
b.w = f
n.u = l
n.w = h
n.s = k
l.p = g
l.w = f
k.x = f
k.v = l
k.s = l
k.q = i
k.y = n
assert l.w.q.z.txt == "
class A:
    def __init__(self, txt: str):
        self.u: F = None
        self.w: A = None
        self.s: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.w: D = None
        self.q: A = None
        self.z: D = None
        self.r: F = None
        self.txt = txt

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

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

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

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

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

h.u = b
h.w = n
h.s = k
g.w = f
g.z = f
g.q = h
g.r = l
i.z = g
f.x = k
f.v = l
f.s = l
f.q = i
f.y = n
m.s = g
m.p = i
b.p = g
b.w = f
n.u = l
n.w = h
n.s = k
l.p = g
l.w = f
k.x = f
k.v = l
k.s = l
k.q = i
k.y = n
assert l.w.q.z.txt == "g"