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

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

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

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

class E:
    def __init__(self, txt: str):
        self.q: D = None
        self.y: C = None
        self.v: A = None
        self.t: F = None
        self.w: A = None
        self.txt = txt

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

h = A("h")
i = B("i")
n = C("n")
d = D("d")
k = E("k")
g = F("g")
l = E("l")

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.q: D = None
        self.y: C = None
        self.v: A = None
        self.t: F = None
        self.w: A = None
        self.txt = txt

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

h = A("h")
i = B("i")
n = C("n")
d = D("d")
k = E("k")
g = F("g")
l = E("l")

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