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

class B:
    def __init__(self, txt: str):
        self.w: E = None
        self.x: E = None
        self.u: B = None
        self.r: C = None
        self.t: F = None
        self.txt = txt

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

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

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

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

h = A("h")
l = B("l")
f = C("f")
i = D("i")
d = E("d")
j = F("j")
n = B("n")
a = E("a")

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

class B:
    def __init__(self, txt: str):
        self.w: E = None
        self.x: E = None
        self.u: B = None
        self.r: C = None
        self.t: F = None
        self.txt = txt

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

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

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

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

h = A("h")
l = B("l")
f = C("f")
i = D("i")
d = E("d")
j = F("j")
n = B("n")
a = E("a")

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