class A:
    def __init__(self, txt: str):
        self.v: D = None
        self.q: C = None
        self.o: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.p: A = None
        self.y: D = None
        self.txt = txt

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

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

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.p: A = None
        self.y: D = None
        self.txt = txt

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

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

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

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

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

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