class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.w: B = None
        self.z: E = None
        self.s: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.r: F = None
        self.s: F = None
        self.q: D = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.r: A = None
        self.p: B = None
        self.o: C = None
        self.v: B = None
        self.z: F = None
        self.txt = txt

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

b = A("b")
j = B("j")
i = C("i")
n = D("n")
d = E("d")
k = F("k")

b.r = i
b.w = j
b.z = d
b.s = n
j.r = k
j.s = k
j.q = n
i.x = n
i.t = j
n.y = b
n.u = b
n.v = i
n.p = d
n.r = d
d.r = b
d.p = j
d.v = j
d.o = i
d.z = k
k.o = n
k.v = b
k.p = b
k.t = d
assert k.t.p.q.v.txt == "
class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.w: B = None
        self.z: E = None
        self.s: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.r: F = None
        self.s: F = None
        self.q: D = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.r: A = None
        self.p: B = None
        self.o: C = None
        self.v: B = None
        self.z: F = None
        self.txt = txt

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

b = A("b")
j = B("j")
i = C("i")
n = D("n")
d = E("d")
k = F("k")

b.r = i
b.w = j
b.z = d
b.s = n
j.r = k
j.s = k
j.q = n
i.x = n
i.t = j
n.y = b
n.u = b
n.v = i
n.p = d
n.r = d
d.r = b
d.p = j
d.v = j
d.o = i
d.z = k
k.o = n
k.v = b
k.p = b
k.t = d
assert k.t.p.q.v.txt == "i"