class A:
    def __init__(self, txt: str):
        self.p: F = None
        self.z: D = None
        self.x: C = None
        self.u: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.v: H = None
        self.w: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.r: F = None
        self.txt = txt

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

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

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

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

l = A("l")
c = B("c")
a = C("a")
f = D("f")
k = E("k")
g = F("g")
e = G("e")
h = H("h")
m = B("m")

l.p = g
l.z = f
l.x = a
l.u = a
c.q = f
c.r = l
c.s = g
c.x = a
c.u = m
c.t = e
a.v = h
a.w = m
f.r = g
k.w = e
k.p = g
g.o = a
e.t = c
e.z = a
e.s = k
h.s = g
h.u = a
h.p = f
m.q = f
m.r = l
m.s = g
m.x = a
m.u = c
m.t = e
assert a.w.t.z.w.x.txt == "
class A:
    def __init__(self, txt: str):
        self.p: F = None
        self.z: D = None
        self.x: C = None
        self.u: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.v: H = None
        self.w: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.r: F = None
        self.txt = txt

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

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

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

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

l = A("l")
c = B("c")
a = C("a")
f = D("f")
k = E("k")
g = F("g")
e = G("e")
h = H("h")
m = B("m")

l.p = g
l.z = f
l.x = a
l.u = a
c.q = f
c.r = l
c.s = g
c.x = a
c.u = m
c.t = e
a.v = h
a.w = m
f.r = g
k.w = e
k.p = g
g.o = a
e.t = c
e.z = a
e.s = k
h.s = g
h.u = a
h.p = f
m.q = f
m.r = l
m.s = g
m.x = a
m.u = c
m.t = e
assert a.w.t.z.w.x.txt == "a"