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

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

class C:
    def __init__(self, txt: str):
        self.o: F = None
        self.q: D = None
        self.z: D = None
        self.s: G = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.r: F = None
        self.s: C = None
        self.o: A = None
        self.u: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.y: G = None
        self.v: B = None
        self.u: D = None
        self.q: B = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.s: C = None
        self.z: D = None
        self.q: C = None
        self.y: C = None
        self.txt = txt

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

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

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

class C:
    def __init__(self, txt: str):
        self.o: F = None
        self.q: D = None
        self.z: D = None
        self.s: G = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.r: F = None
        self.s: C = None
        self.o: A = None
        self.u: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.y: G = None
        self.v: B = None
        self.u: D = None
        self.q: B = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.s: C = None
        self.z: D = None
        self.q: C = None
        self.y: C = None
        self.txt = txt

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

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