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

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

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

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

class E:
    def __init__(self, txt: str):
        self.x: B = None
        self.txt = txt

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

e = A("e")
j = B("j")
g = C("g")
n = D("n")
b = E("b")
h = F("h")
c = D("c")
i = C("i")
f = E("f")
k = F("k")

e.r = k
j.x = n
j.u = k
j.o = f
j.w = b
j.y = h
g.s = j
g.y = j
n.t = c
n.u = e
b.x = j
h.w = k
c.t = n
c.u = e
i.s = j
i.y = j
f.x = j
k.w = h
assert f.x.u.w.w.txt == "
class A:
    def __init__(self, txt: str):
        self.r: F = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.x: B = None
        self.txt = txt

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

e = A("e")
j = B("j")
g = C("g")
n = D("n")
b = E("b")
h = F("h")
c = D("c")
i = C("i")
f = E("f")
k = F("k")

e.r = k
j.x = n
j.u = k
j.o = f
j.w = b
j.y = h
g.s = j
g.y = j
n.t = c
n.u = e
b.x = j
h.w = k
c.t = n
c.u = e
i.s = j
i.y = j
f.x = j
k.w = h
assert f.x.u.w.w.txt == "k"