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

class B:
    def __init__(self, txt: str):
        self.r: A = None
        self.x: D = None
        self.p: D = None
        self.y: A = None
        self.w: A = None
        self.t: E = None
        self.o: C = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.s: B = None
        self.r: B = None
        self.o: G = None
        self.txt = txt

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.r: A = None
        self.x: D = None
        self.p: D = None
        self.y: A = None
        self.w: A = None
        self.t: E = None
        self.o: C = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.s: B = None
        self.r: B = None
        self.o: G = None
        self.txt = txt

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

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

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

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