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

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

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

class D:
    def __init__(self, txt: str):
        self.s: B = None
        self.x: B = None
        self.t: E = None
        self.w: E = None
        self.o: C = None
        self.txt = txt

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

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

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

b.q = f
h.v = b
h.y = f
f.o = i
f.s = l
i.s = h
i.x = h
i.t = l
i.w = l
i.o = f
l.t = b
l.w = h
l.o = h
l.v = f
l.s = g
g.w = i
g.y = b
assert g.y.q.s.t.txt == "
class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.s: B = None
        self.x: B = None
        self.t: E = None
        self.w: E = None
        self.o: C = None
        self.txt = txt

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

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

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

b.q = f
h.v = b
h.y = f
f.o = i
f.s = l
i.s = h
i.x = h
i.t = l
i.w = l
i.o = f
l.t = b
l.w = h
l.o = h
l.v = f
l.s = g
g.w = i
g.y = b
assert g.y.q.s.t.txt == "b"