class A:
    def __init__(self, txt: str):
        self.s: F = None
        self.z: C = None
        self.r: F = None
        self.x: B = None
        self.y: E = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.z: F = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.u: A = None
        self.txt = txt

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.z: F = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.u: A = None
        self.txt = txt

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

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