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

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

class C:
    def __init__(self, txt: str):
        self.v: E = None
        self.x: A = None
        self.o: F = None
        self.r: A = None
        self.w: F = None
        self.p: B = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.z: E = None
        self.txt = txt

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

c.z = i
i.r = g
i.t = b
h.v = g
h.x = c
h.r = c
h.o = f
h.w = f
h.p = i
b.w = c
b.r = i
b.s = i
g.y = b
g.t = c
g.x = i
f.z = g
assert g.t.z.t.s.r.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.v: E = None
        self.x: A = None
        self.o: F = None
        self.r: A = None
        self.w: F = None
        self.p: B = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.z: E = None
        self.txt = txt

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

c.z = i
i.r = g
i.t = b
h.v = g
h.x = c
h.r = c
h.o = f
h.w = f
h.p = i
b.w = c
b.r = i
b.s = i
g.y = b
g.t = c
g.x = i
f.z = g
assert g.t.z.t.s.r.txt == "g"