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

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

class C:
    def __init__(self, txt: str):
        self.y: A = None
        self.z: E = None
        self.r: A = None
        self.p: G = None
        self.q: F = None
        self.v: E = None
        self.u: A = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.x: F = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.p: F = None
        self.u: E = None
        self.t: D = None
        self.q: E = None
        self.o: E = None
        self.txt = txt

m = A("m")
i = B("i")
d = C("d")
h = D("h")
k = E("k")
n = F("n")
j = G("j")

m.t = h
i.u = j
i.p = j
i.w = j
i.y = k
i.q = h
d.y = m
d.r = m
d.u = m
d.z = k
d.v = k
d.p = j
d.q = n
h.y = i
k.x = n
n.x = i
j.p = n
j.u = k
j.q = k
j.o = k
j.t = h
assert n.x.q.y.txt == "
class A:
    def __init__(self, txt: str):
        self.t: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.y: A = None
        self.z: E = None
        self.r: A = None
        self.p: G = None
        self.q: F = None
        self.v: E = None
        self.u: A = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.x: F = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.p: F = None
        self.u: E = None
        self.t: D = None
        self.q: E = None
        self.o: E = None
        self.txt = txt

m = A("m")
i = B("i")
d = C("d")
h = D("h")
k = E("k")
n = F("n")
j = G("j")

m.t = h
i.u = j
i.p = j
i.w = j
i.y = k
i.q = h
d.y = m
d.r = m
d.u = m
d.z = k
d.v = k
d.p = j
d.q = n
h.y = i
k.x = n
n.x = i
j.p = n
j.u = k
j.q = k
j.o = k
j.t = h
assert n.x.q.y.txt == "i"