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

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

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

class D:
    def __init__(self, txt: str):
        self.y: A = None
        self.o: B = None
        self.u: G = None
        self.x: A = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.v: D = None
        self.y: E = None
        self.r: B = None
        self.z: D = None
        self.txt = txt

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

m = A("m")
f = B("f")
i = C("i")
b = D("b")
l = E("l")
g = F("g")
n = G("n")

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

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

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

class D:
    def __init__(self, txt: str):
        self.y: A = None
        self.o: B = None
        self.u: G = None
        self.x: A = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.v: D = None
        self.y: E = None
        self.r: B = None
        self.z: D = None
        self.txt = txt

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

m = A("m")
f = B("f")
i = C("i")
b = D("b")
l = E("l")
g = F("g")
n = G("n")

m.y = f
m.t = f
f.y = m
i.z = b
i.y = b
i.q = b
i.u = m
i.v = m
i.w = f
b.y = m
b.x = m
b.o = f
b.u = n
l.o = n
l.p = n
g.v = b
g.z = b
g.y = l
g.r = f
n.s = b
n.t = b
n.x = g
assert f.y.t.y.txt == "m"