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

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

class C:
    def __init__(self, txt: str):
        self.y: F = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.s: E = None
        self.v: B = None
        self.q: E = None
        self.y: E = None
        self.txt = txt

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

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

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

class C:
    def __init__(self, txt: str):
        self.y: F = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.s: E = None
        self.v: B = None
        self.q: E = None
        self.y: E = None
        self.txt = txt

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

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