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

class B:
    def __init__(self, txt: str):
        self.s: C = None
        self.u: F = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.u: A = None
        self.t: D = None
        self.s: D = None
        self.w: E = None
        self.txt = txt

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

h.s = i
h.p = b
h.y = b
k.s = m
k.u = l
i.y = h
b.t = m
b.u = f
d.z = h
l.u = h
l.t = b
l.s = b
l.w = d
m.y = h
f.z = h
assert h.s.y.y.txt == "
class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.p: D = None
        self.y: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.s: C = None
        self.u: F = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.u: A = None
        self.t: D = None
        self.s: D = None
        self.w: E = None
        self.txt = txt

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

h.s = i
h.p = b
h.y = b
k.s = m
k.u = l
i.y = h
b.t = m
b.u = f
d.z = h
l.u = h
l.t = b
l.s = b
l.w = d
m.y = h
f.z = h
assert h.s.y.y.txt == "b"