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

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

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

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

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

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

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

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

n.q = m
n.t = g
n.w = g
n.z = g
n.r = f
n.p = l
f.p = m
k.q = i
k.t = i
k.y = m
k.w = m
g.y = k
g.p = k
g.r = n
i.z = c
i.p = c
m.z = g
c.s = f
c.w = l
c.r = k
c.y = g
c.x = i
l.p = m
assert l.p.z.r.w.r.t.p.w.txt == "
class A:
    def __init__(self, txt: str):
        self.q: F = None
        self.t: D = None
        self.r: B = None
        self.w: D = None
        self.p: B = None
        self.z: D = None
        self.txt = txt

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

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

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

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

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

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

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

n.q = m
n.t = g
n.w = g
n.z = g
n.r = f
n.p = l
f.p = m
k.q = i
k.t = i
k.y = m
k.w = m
g.y = k
g.p = k
g.r = n
i.z = c
i.p = c
m.z = g
c.s = f
c.w = l
c.r = k
c.y = g
c.x = i
l.p = m
assert l.p.z.r.w.r.t.p.w.txt == "m"