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

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

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

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

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

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

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

g.w = b
g.u = b
h.s = i
k.x = f
b.q = a
b.r = f
i.x = a
i.v = f
i.t = g
i.u = b
a.v = g
f.s = i
assert h.s.u.q.v.u.txt == "
class A:
    def __init__(self, txt: str):
        self.w: D = None
        self.u: D = None
        self.txt = txt

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

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

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

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

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

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

g.w = b
g.u = b
h.s = i
k.x = f
b.q = a
b.r = f
i.x = a
i.v = f
i.t = g
i.u = b
a.v = g
f.s = i
assert h.s.u.q.v.u.txt == "b"