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

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

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

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

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

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

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

i.u = k
i.x = k
i.r = n
i.q = f
i.v = b
i.w = g
f.t = i
n.w = g
g.r = n
g.w = b
b.q = g
b.y = f
b.x = n
k.y = g
assert k.y.r.w.txt == "
class A:
    def __init__(self, txt: str):
        self.u: F = None
        self.r: C = None
        self.q: B = None
        self.v: E = None
        self.w: D = None
        self.x: F = None
        self.txt = txt

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

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

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

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

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

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

i.u = k
i.x = k
i.r = n
i.q = f
i.v = b
i.w = g
f.t = i
n.w = g
g.r = n
g.w = b
b.q = g
b.y = f
b.x = n
k.y = g
assert k.y.r.w.txt == "g"