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

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

class C:
    def __init__(self, txt: str):
        self.x: A = None
        self.v: F = None
        self.o: B = None
        self.t: B = None
        self.s: A = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.y: C = None
        self.v: D = None
        self.r: D = None
        self.s: A = None
        self.q: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.q: B = None
        self.y: B = None
        self.o: E = None
        self.z: D = None
        self.txt = txt

g = A("g")
b = B("b")
l = C("l")
n = D("n")
m = E("m")
h = F("h")

g.w = n
b.s = g
l.x = g
l.s = g
l.v = h
l.o = b
l.t = b
n.x = g
m.y = l
m.v = n
m.r = n
m.q = n
m.s = g
h.q = b
h.y = b
h.o = m
h.z = n
assert h.o.y.v.q.txt == "
class A:
    def __init__(self, txt: str):
        self.w: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.x: A = None
        self.v: F = None
        self.o: B = None
        self.t: B = None
        self.s: A = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.y: C = None
        self.v: D = None
        self.r: D = None
        self.s: A = None
        self.q: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.q: B = None
        self.y: B = None
        self.o: E = None
        self.z: D = None
        self.txt = txt

g = A("g")
b = B("b")
l = C("l")
n = D("n")
m = E("m")
h = F("h")

g.w = n
b.s = g
l.x = g
l.s = g
l.v = h
l.o = b
l.t = b
n.x = g
m.y = l
m.v = n
m.r = n
m.q = n
m.s = g
h.q = b
h.y = b
h.o = m
h.z = n
assert h.o.y.v.q.txt == "b"