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

class B:
    def __init__(self, txt: str):
        self.r: E = None
        self.u: E = None
        self.w: C = None
        self.o: F = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.u: D = None
        self.t: A = None
        self.v: B = None
        self.w: F = None
        self.q: D = None
        self.x: A = None
        self.txt = txt

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

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

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

class B:
    def __init__(self, txt: str):
        self.r: E = None
        self.u: E = None
        self.w: C = None
        self.o: F = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.u: D = None
        self.t: A = None
        self.v: B = None
        self.w: F = None
        self.q: D = None
        self.x: A = None
        self.txt = txt

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

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

m.t = b
m.y = e
m.w = f
e.r = b
e.u = b
e.w = g
e.o = f
g.q = f
g.t = f
g.w = b
h.w = f
b.u = h
b.q = h
b.t = m
b.x = m
b.v = e
b.w = f
f.p = g
k.t = b
k.y = e
k.w = f
i.w = f
assert h.w.p.w.u.w.p.w.w.txt == "f"