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

class B:
    def __init__(self, txt: str):
        self.s: A = None
        self.p: C = None
        self.y: F = None
        self.u: A = None
        self.v: D = None
        self.x: F = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.z: B = None
        self.u: F = None
        self.p: B = None
        self.r: D = None
        self.txt = txt

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

j = A("j")
i = B("i")
b = C("b")
g = D("g")
k = E("k")
f = F("f")
n = F("n")
h = A("h")

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

class B:
    def __init__(self, txt: str):
        self.s: A = None
        self.p: C = None
        self.y: F = None
        self.u: A = None
        self.v: D = None
        self.x: F = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.z: B = None
        self.u: F = None
        self.p: B = None
        self.r: D = None
        self.txt = txt

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

j = A("j")
i = B("i")
b = C("b")
g = D("g")
k = E("k")
f = F("f")
n = F("n")
h = A("h")

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