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

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

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

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

class E:
    def __init__(self, txt: str):
        self.p: B = None
        self.s: D = None
        self.z: G = None
        self.w: C = None
        self.v: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.q: G = None
        self.x: G = None
        self.r: E = None
        self.y: A = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.y: E = None
        self.x: D = None
        self.u: A = None
        self.s: E = None
        self.txt = txt

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

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.p: B = None
        self.s: D = None
        self.z: G = None
        self.w: C = None
        self.v: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.q: G = None
        self.x: G = None
        self.r: E = None
        self.y: A = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.y: E = None
        self.x: D = None
        self.u: A = None
        self.s: E = None
        self.txt = txt

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

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