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

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

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

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

class E:
    def __init__(self, txt: str):
        self.t: C = None
        self.y: D = None
        self.q: B = None
        self.x: C = None
        self.z: B = None
        self.txt = txt

c = A("c")
m = B("m")
g = C("g")
n = D("n")
d = E("d")
b = E("b")
f = A("f")

c.t = g
c.w = m
m.q = f
m.w = n
g.s = b
n.v = g
d.t = g
d.x = g
d.y = n
d.q = m
d.z = m
b.t = g
b.x = g
b.y = n
b.q = m
b.z = m
f.t = g
f.w = m
assert g.s.t.s.txt == "
class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.w: B = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.t: C = None
        self.y: D = None
        self.q: B = None
        self.x: C = None
        self.z: B = None
        self.txt = txt

c = A("c")
m = B("m")
g = C("g")
n = D("n")
d = E("d")
b = E("b")
f = A("f")

c.t = g
c.w = m
m.q = f
m.w = n
g.s = b
n.v = g
d.t = g
d.x = g
d.y = n
d.q = m
d.z = m
b.t = g
b.x = g
b.y = n
b.q = m
b.z = m
f.t = g
f.w = m
assert g.s.t.s.txt == "b"