class A:
    def __init__(self, txt: str):
        self.r: D = None
        self.t: D = None
        self.z: B = None
        self.u: C = None
        self.q: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.q: A = None
        self.p: C = None
        self.o: E = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.t: E = None
        self.z: A = None
        self.w: G = None
        self.u: C = None
        self.p: G = None
        self.q: C = None
        self.x: E = None
        self.txt = txt

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

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.q: A = None
        self.p: C = None
        self.o: E = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.t: E = None
        self.z: A = None
        self.w: G = None
        self.u: C = None
        self.p: G = None
        self.q: C = None
        self.x: E = None
        self.txt = txt

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

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

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

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

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