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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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