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

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

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

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

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

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

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

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

c.t = j
g.s = c
g.x = h
n.t = g
h.x = c
h.r = b
h.y = b
h.w = g
h.o = j
h.u = k
k.t = n
k.w = n
j.q = c
j.r = c
b.t = j
assert h.u.w.t.x.r.t.txt == "
class A:
    def __init__(self, txt: str):
        self.t: F = None
        self.txt = txt

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

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

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

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

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

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

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

c.t = j
g.s = c
g.x = h
n.t = g
h.x = c
h.r = b
h.y = b
h.w = g
h.o = j
h.u = k
k.t = n
k.w = n
j.q = c
j.r = c
b.t = j
assert h.u.w.t.x.r.t.txt == "j"