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

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

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

class D:
    def __init__(self, txt: str):
        self.p: C = None
        self.s: C = None
        self.y: B = None
        self.o: A = None
        self.q: E = None
        self.txt = txt

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

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

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.p: C = None
        self.s: C = None
        self.y: B = None
        self.o: A = None
        self.q: E = None
        self.txt = txt

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

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

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

a.r = k
a.p = j
a.v = f
a.t = f
b.p = a
m.v = a
m.q = h
j.p = k
j.s = m
j.y = b
j.o = a
j.q = h
d.q = m
d.w = m
d.t = a
f.r = d
k.v = a
k.q = h
h.q = k
h.w = m
h.t = a
assert k.v.p.s.q.t.p.txt == "j"