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

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

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

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

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

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

f = A("f")
a = B("a")
i = C("i")
m = D("m")
h = E("h")
k = F("k")
j = E("j")
g = D("g")
n = A("n")

f.u = n
f.y = k
a.x = k
a.s = k
a.o = k
a.u = k
a.q = k
i.u = k
i.t = h
i.w = f
i.o = g
m.z = a
m.y = f
m.w = k
h.y = i
h.p = f
h.t = g
k.u = g
k.w = i
j.y = i
j.p = f
j.t = g
g.z = a
g.y = f
g.w = k
n.u = f
n.y = k
assert g.w.u.y.txt == "
class A:
    def __init__(self, txt: str):
        self.u: A = None
        self.y: F = None
        self.txt = txt

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

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

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

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

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

f = A("f")
a = B("a")
i = C("i")
m = D("m")
h = E("h")
k = F("k")
j = E("j")
g = D("g")
n = A("n")

f.u = n
f.y = k
a.x = k
a.s = k
a.o = k
a.u = k
a.q = k
i.u = k
i.t = h
i.w = f
i.o = g
m.z = a
m.y = f
m.w = k
h.y = i
h.p = f
h.t = g
k.u = g
k.w = i
j.y = i
j.p = f
j.t = g
g.z = a
g.y = f
g.w = k
n.u = f
n.y = k
assert g.w.u.y.txt == "f"