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

class B:
    def __init__(self, txt: str):
        self.q: D = None
        self.p: G = None
        self.s: A = None
        self.r: C = None
        self.t: G = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.w: A = None
        self.s: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.t: E = None
        self.y: A = None
        self.o: E = 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.y: A = None
        self.x: E = None
        self.u: G = None
        self.p: A = None
        self.v: D = None
        self.t: G = None
        self.z: D = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.x: C = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.q: D = None
        self.p: G = None
        self.s: A = None
        self.r: C = None
        self.t: G = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.w: A = None
        self.s: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.t: E = None
        self.y: A = None
        self.o: E = 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.y: A = None
        self.x: E = None
        self.u: G = None
        self.p: A = None
        self.v: D = None
        self.t: G = None
        self.z: D = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.x: C = None
        self.txt = txt

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

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