class A:
    def __init__(self, txt: str):
        self.t: G = None
        self.y: B = None
        self.p: E = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.r: B = None
        self.x: G = None
        self.u: A = None
        self.q: A = None
        self.y: E = None
        self.p: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.t: A = None
        self.x: G = None
        self.txt = txt

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

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

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.r: B = None
        self.x: G = None
        self.u: A = None
        self.q: A = None
        self.y: E = None
        self.p: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.t: A = None
        self.x: G = None
        self.txt = txt

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

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

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

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