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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.v: E = None
        self.y: D = None
        self.w: E = None
        self.t: B = None
        self.p: D = None
        self.txt = txt

j = A("j")
d = B("d")
k = C("k")
e = D("e")
i = E("i")
c = F("c")

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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.v: E = None
        self.y: D = None
        self.w: E = None
        self.t: B = None
        self.p: D = None
        self.txt = txt

j = A("j")
d = B("d")
k = C("k")
e = D("e")
i = E("i")
c = F("c")

j.r = c
d.q = i
d.s = i
d.p = c
k.q = i
k.r = i
k.s = e
e.q = i
i.v = j
i.t = e
i.x = k
i.y = k
c.v = i
c.w = i
c.y = e
c.p = e
c.t = d
assert d.s.t.q.txt == "i"