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

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

class C:
    def __init__(self, txt: str):
        self.w: A = None
        self.u: G = None
        self.r: B = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.y: E = None
        self.u: A = None
        self.w: C = None
        self.o: F = None
        self.txt = txt

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

f = A("f")
g = B("g")
n = C("n")
h = D("h")
d = E("d")
i = F("i")
k = G("k")
c = F("c")

f.v = k
f.x = k
f.s = c
g.x = d
g.y = d
g.z = f
g.o = h
n.w = f
n.u = k
n.r = g
h.r = f
h.x = f
h.s = f
d.v = n
d.q = n
d.y = c
i.y = d
i.u = f
i.w = n
i.o = c
k.r = f
c.y = d
c.u = f
c.w = n
c.o = i
assert f.x.r.s.u.s.txt == "
class A:
    def __init__(self, txt: str):
        self.v: G = None
        self.x: G = None
        self.s: F = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.w: A = None
        self.u: G = None
        self.r: B = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.y: E = None
        self.u: A = None
        self.w: C = None
        self.o: F = None
        self.txt = txt

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

f = A("f")
g = B("g")
n = C("n")
h = D("h")
d = E("d")
i = F("i")
k = G("k")
c = F("c")

f.v = k
f.x = k
f.s = c
g.x = d
g.y = d
g.z = f
g.o = h
n.w = f
n.u = k
n.r = g
h.r = f
h.x = f
h.s = f
d.v = n
d.q = n
d.y = c
i.y = d
i.u = f
i.w = n
i.o = c
k.r = f
c.y = d
c.u = f
c.w = n
c.o = i
assert f.x.r.s.u.s.txt == "c"