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

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

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

class D:
    def __init__(self, txt: str):
        self.u: F = None
        self.v: C = None
        self.z: B = None
        self.txt = txt

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

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

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.u: F = None
        self.v: C = None
        self.z: B = None
        self.txt = txt

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

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

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

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