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

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

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

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

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

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

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

e.v = j
e.y = j
b.p = i
d.q = j
d.y = j
d.z = a
a.s = i
a.r = j
i.r = d
j.v = b
j.s = i
j.x = e
assert d.z.r.s.r.txt == "
class A:
    def __init__(self, txt: str):
        self.v: F = None
        self.y: F = None
        self.txt = txt

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

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

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

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

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

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

e.v = j
e.y = j
b.p = i
d.q = j
d.y = j
d.z = a
a.s = i
a.r = j
i.r = d
j.v = b
j.s = i
j.x = e
assert d.z.r.s.r.txt == "d"