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

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

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

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

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

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

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

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

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

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

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

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

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

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

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