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

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

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

class D:
    def __init__(self, txt: str):
        self.o: D = None
        self.p: G = None
        self.x: F = None
        self.z: D = None
        self.txt = txt

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

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

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

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.o: D = None
        self.p: G = None
        self.x: F = None
        self.z: D = None
        self.txt = txt

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

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

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

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

e.w = b
b.x = d
h.t = c
h.y = f
h.u = b
g.o = k
g.z = k
g.p = j
g.x = f
d.s = f
f.w = j
j.w = f
k.o = g
k.z = g
k.p = j
k.x = f
c.w = b
assert j.w.w.w.w.w.w.w.txt == "f"