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

class B:
    def __init__(self, txt: str):
        self.x: D = None
        self.u: G = None
        self.r: D = None
        self.z: G = None
        self.txt = txt

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.p: B = None
        self.t: D = None
        self.s: A = None
        self.u: B = None
        self.y: C = None
        self.w: A = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.x: D = None
        self.u: G = None
        self.r: D = None
        self.z: G = None
        self.txt = txt

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.p: B = None
        self.t: D = None
        self.s: A = None
        self.u: B = None
        self.y: C = None
        self.w: A = None
        self.txt = txt

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

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