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

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

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

class D:
    def __init__(self, txt: str):
        self.w: F = None
        self.x: F = None
        self.q: C = None
        self.txt = txt

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

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

d = A("d")
f = B("f")
e = C("e")
m = D("m")
j = E("j")
h = F("h")
i = E("i")

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

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

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

class D:
    def __init__(self, txt: str):
        self.w: F = None
        self.x: F = None
        self.q: C = None
        self.txt = txt

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

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

d = A("d")
f = B("f")
e = C("e")
m = D("m")
j = E("j")
h = F("h")
i = E("i")

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