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

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

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

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

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

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

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

c = A("c")
h = B("h")
l = C("l")
g = D("g")
j = E("j")
e = F("e")
f = G("f")

c.t = h
h.t = j
h.s = e
l.p = e
l.t = c
l.y = h
g.s = f
g.u = f
g.w = j
j.p = l
j.z = h
e.w = c
e.y = c
e.q = g
f.y = e
f.q = e
f.x = j
assert l.y.t.z.s.q.w.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.txt = txt

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

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

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

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

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

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

c = A("c")
h = B("h")
l = C("l")
g = D("g")
j = E("j")
e = F("e")
f = G("f")

c.t = h
h.t = j
h.s = e
l.p = e
l.t = c
l.y = h
g.s = f
g.u = f
g.w = j
j.p = l
j.z = h
e.w = c
e.y = c
e.q = g
f.y = e
f.q = e
f.x = j
assert l.y.t.z.s.q.w.txt == "j"