class A:
    def __init__(self, txt: str):
        self.x: D = None
        self.p: B = None
        self.s: G = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.u: G = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.q: C = None
        self.o: D = None
        self.r: A = None
        self.p: C = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.v: D = None
        self.w: D = None
        self.z: A = None
        self.txt = txt

l = A("l")
h = B("h")
g = C("g")
m = D("m")
a = E("a")
j = F("j")
b = G("b")
n = C("n")

l.x = m
l.p = h
l.s = b
h.y = m
h.x = j
h.p = n
g.y = n
g.w = n
g.t = n
g.x = l
g.p = j
g.o = m
m.u = b
a.u = m
a.z = m
a.q = j
j.q = n
j.o = m
j.r = l
j.p = g
b.v = m
b.w = m
b.z = l
n.y = g
n.w = g
n.t = g
n.x = l
n.p = j
n.o = m
assert h.x.r.x.u.z.x.txt == "
class A:
    def __init__(self, txt: str):
        self.x: D = None
        self.p: B = None
        self.s: G = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.u: G = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.q: C = None
        self.o: D = None
        self.r: A = None
        self.p: C = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.v: D = None
        self.w: D = None
        self.z: A = None
        self.txt = txt

l = A("l")
h = B("h")
g = C("g")
m = D("m")
a = E("a")
j = F("j")
b = G("b")
n = C("n")

l.x = m
l.p = h
l.s = b
h.y = m
h.x = j
h.p = n
g.y = n
g.w = n
g.t = n
g.x = l
g.p = j
g.o = m
m.u = b
a.u = m
a.z = m
a.q = j
j.q = n
j.o = m
j.r = l
j.p = g
b.v = m
b.w = m
b.z = l
n.y = g
n.w = g
n.t = g
n.x = l
n.p = j
n.o = m
assert h.x.r.x.u.z.x.txt == "m"