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

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

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

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

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

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

g = A("g")
a = B("a")
n = C("n")
c = D("c")
e = E("e")
k = F("k")
i = E("i")
f = E("f")

g.y = n
g.x = k
g.w = c
g.r = a
a.t = k
a.u = i
n.z = a
n.w = k
c.u = g
c.z = e
e.s = n
k.y = g
k.t = g
i.s = n
f.s = n
assert c.z.s.z.t.t.w.u.w.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.x: F = None
        self.w: D = None
        self.r: B = None
        self.txt = txt

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

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

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

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

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

g = A("g")
a = B("a")
n = C("n")
c = D("c")
e = E("e")
k = F("k")
i = E("i")
f = E("f")

g.y = n
g.x = k
g.w = c
g.r = a
a.t = k
a.u = i
n.z = a
n.w = k
c.u = g
c.z = e
e.s = n
k.y = g
k.t = g
i.s = n
f.s = n
assert c.z.s.z.t.t.w.u.w.txt == "c"