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

class B:
    def __init__(self, txt: str):
        self.r: F = None
        self.s: D = None
        self.v: F = None
        self.t: C = None
        self.o: C = None
        self.w: D = None
        self.z: E = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.v: A = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.o: E = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.r: F = None
        self.s: D = None
        self.v: F = None
        self.t: C = None
        self.o: C = None
        self.w: D = None
        self.z: E = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.v: A = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.o: E = None
        self.txt = txt

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

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