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

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

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

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

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

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

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

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

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

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

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

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

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

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

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