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

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

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

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

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

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

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

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

g.u = e
g.r = c
c.v = h
c.x = h
n.z = b
n.o = k
b.s = f
b.t = c
k.v = b
e.w = n
h.t = e
f.u = e
f.r = c
assert f.u.w.o.txt == "
class A:
    def __init__(self, txt: str):
        self.u: F = None
        self.r: B = None
        self.txt = txt

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

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

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

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

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

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

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

g.u = e
g.r = c
c.v = h
c.x = h
n.z = b
n.o = k
b.s = f
b.t = c
k.v = b
e.w = n
h.t = e
f.u = e
f.r = c
assert f.u.w.o.txt == "k"