class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.x: F = None
        self.v: C = None
        self.p: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.q: A = None
        self.t: D = None
        self.txt = txt

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

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

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

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.q: A = None
        self.t: D = None
        self.txt = txt

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

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

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

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

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

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

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