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

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

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

class D:
    def __init__(self, txt: str):
        self.w: F = None
        self.z: F = None
        self.y: F = None
        self.t: E = None
        self.o: A = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.r: E = None
        self.q: C = None
        self.s: G = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.t: B = None
        self.q: B = None
        self.txt = txt

h = A("h")
g = B("g")
k = C("k")
e = D("e")
j = E("j")
n = F("n")
i = G("i")
f = E("f")
l = F("l")

h.w = g
g.r = k
g.y = k
g.q = h
g.p = e
g.w = e
k.q = e
k.o = g
k.u = g
k.w = n
k.t = n
k.x = h
e.w = l
e.y = l
e.z = n
e.t = j
e.o = h
j.r = f
j.q = k
j.s = i
n.y = g
n.u = g
n.p = h
n.w = e
i.t = g
i.q = g
f.r = j
f.q = k
f.s = i
l.y = g
l.u = g
l.p = h
l.w = e
assert l.p.w.p.o.txt == "
class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.w: F = None
        self.z: F = None
        self.y: F = None
        self.t: E = None
        self.o: A = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.r: E = None
        self.q: C = None
        self.s: G = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.t: B = None
        self.q: B = None
        self.txt = txt

h = A("h")
g = B("g")
k = C("k")
e = D("e")
j = E("j")
n = F("n")
i = G("i")
f = E("f")
l = F("l")

h.w = g
g.r = k
g.y = k
g.q = h
g.p = e
g.w = e
k.q = e
k.o = g
k.u = g
k.w = n
k.t = n
k.x = h
e.w = l
e.y = l
e.z = n
e.t = j
e.o = h
j.r = f
j.q = k
j.s = i
n.y = g
n.u = g
n.p = h
n.w = e
i.t = g
i.q = g
f.r = j
f.q = k
f.s = i
l.y = g
l.u = g
l.p = h
l.w = e
assert l.p.w.p.o.txt == "h"