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

class B:
    def __init__(self, txt: str):
        self.y: E = None
        self.r: D = None
        self.s: G = None
        self.t: C = None
        self.q: C = None
        self.o: G = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.x: D = None
        self.w: A = None
        self.r: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.y: A = None
        self.t: C = None
        self.r: G = None
        self.txt = txt

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

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.y: E = None
        self.r: D = None
        self.s: G = None
        self.t: C = None
        self.q: C = None
        self.o: G = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.x: D = None
        self.w: A = None
        self.r: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.y: A = None
        self.t: C = None
        self.r: G = None
        self.txt = txt

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

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

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

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

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