class A:
    def __init__(self, txt: str):
        self.r: E = None
        self.y: B = None
        self.z: B = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.p: D = None
        self.s: C = None
        self.w: D = None
        self.txt = txt

b = A("b")
e = B("e")
k = C("k")
c = D("c")
i = E("i")
a = F("a")

b.r = i
b.y = e
b.z = e
e.v = k
e.y = i
k.t = a
k.x = a
k.y = c
k.v = i
k.w = i
c.q = b
i.x = k
a.p = c
a.w = c
a.s = k
assert k.y.q.r.txt == "
class A:
    def __init__(self, txt: str):
        self.r: E = None
        self.y: B = None
        self.z: B = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.p: D = None
        self.s: C = None
        self.w: D = None
        self.txt = txt

b = A("b")
e = B("e")
k = C("k")
c = D("c")
i = E("i")
a = F("a")

b.r = i
b.y = e
b.z = e
e.v = k
e.y = i
k.t = a
k.x = a
k.y = c
k.v = i
k.w = i
c.q = b
i.x = k
a.p = c
a.w = c
a.s = k
assert k.y.q.r.txt == "i"