class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.v: F = None
        self.w: D = None
        self.s: D = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.t: A = None
        self.z: C = None
        self.txt = txt

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

a = A("a")
d = B("d")
e = C("e")
m = D("m")
f = E("f")
h = F("h")
b = D("b")

a.r = e
a.v = h
a.w = m
a.s = b
d.z = f
d.p = b
e.q = d
e.r = d
e.t = f
e.p = a
m.t = a
m.z = b
m.r = d
f.t = a
f.z = e
h.t = e
h.r = f
b.t = a
b.z = m
b.r = d
assert f.z.p.r.t.z.txt == "
class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.v: F = None
        self.w: D = None
        self.s: D = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.t: A = None
        self.z: C = None
        self.txt = txt

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

a = A("a")
d = B("d")
e = C("e")
m = D("m")
f = E("f")
h = F("h")
b = D("b")

a.r = e
a.v = h
a.w = m
a.s = b
d.z = f
d.p = b
e.q = d
e.r = d
e.t = f
e.p = a
m.t = a
m.z = b
m.r = d
f.t = a
f.z = e
h.t = e
h.r = f
b.t = a
b.z = m
b.r = d
assert f.z.p.r.t.z.txt == "e"