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

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

class C:
    def __init__(self, txt: str):
        self.z: F = None
        self.p: A = None
        self.r: F = None
        self.w: E = None
        self.u: A = None
        self.q: E = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.q: B = None
        self.p: C = None
        self.txt = txt

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

e = A("e")
j = B("j")
k = C("k")
h = D("h")
a = E("a")
m = F("m")
f = B("f")
c = B("c")

e.z = m
e.r = f
j.v = a
j.u = k
k.z = m
k.r = m
k.p = e
k.u = e
k.w = a
k.q = a
h.z = m
a.q = f
a.p = k
m.p = e
m.u = e
m.v = k
m.q = h
f.v = a
f.u = k
c.v = a
c.u = k
assert m.v.p.z.u.z.p.r.txt == "
class A:
    def __init__(self, txt: str):
        self.z: F = None
        self.r: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.z: F = None
        self.p: A = None
        self.r: F = None
        self.w: E = None
        self.u: A = None
        self.q: E = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.q: B = None
        self.p: C = None
        self.txt = txt

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

e = A("e")
j = B("j")
k = C("k")
h = D("h")
a = E("a")
m = F("m")
f = B("f")
c = B("c")

e.z = m
e.r = f
j.v = a
j.u = k
k.z = m
k.r = m
k.p = e
k.u = e
k.w = a
k.q = a
h.z = m
a.q = f
a.p = k
m.p = e
m.u = e
m.v = k
m.q = h
f.v = a
f.u = k
c.v = a
c.u = k
assert m.v.p.z.u.z.p.r.txt == "f"