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

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

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

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

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

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

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

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

b.y = j
b.r = d
b.q = d
b.x = c
b.t = f
n.q = d
n.u = c
d.s = l
c.w = n
c.t = f
c.x = f
c.z = b
c.q = b
l.y = b
l.z = b
l.u = d
l.w = f
l.p = n
f.x = j
f.w = b
f.s = n
j.q = f
j.p = f
j.y = n
j.s = c
assert n.u.w.q.txt == "
class A:
    def __init__(self, txt: str):
        self.y: G = None
        self.r: C = None
        self.x: D = None
        self.t: F = None
        self.q: C = None
        self.txt = txt

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

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

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

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

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

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

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

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