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

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

class C:
    def __init__(self, txt: str):
        self.t: D = None
        self.z: F = None
        self.p: A = None
        self.r: B = None
        self.x: F = None
        self.txt = txt

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

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

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.t: D = None
        self.z: F = None
        self.p: A = None
        self.r: B = None
        self.x: F = None
        self.txt = txt

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

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

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

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

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