class A:
    def __init__(self, txt: str):
        self.z: F = None
        self.o: G = None
        self.t: C = None
        self.p: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.q: F = None
        self.t: F = None
        self.u: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.s: F = None
        self.q: B = None
        self.w: E = None
        self.p: E = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.y: G = None
        self.w: E = None
        self.t: G = None
        self.txt = txt

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

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

d.z = i
d.o = a
d.t = l
d.p = l
e.x = d
e.y = f
l.q = i
l.t = i
l.u = k
h.s = i
h.q = e
h.w = f
h.p = f
k.p = d
i.y = a
i.t = a
i.w = k
a.y = k
f.p = d
assert d.z.t.y.p.p.q.txt == "
class A:
    def __init__(self, txt: str):
        self.z: F = None
        self.o: G = None
        self.t: C = None
        self.p: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.q: F = None
        self.t: F = None
        self.u: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.s: F = None
        self.q: B = None
        self.w: E = None
        self.p: E = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.y: G = None
        self.w: E = None
        self.t: G = None
        self.txt = txt

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

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

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