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

class B:
    def __init__(self, txt: str):
        self.q: E = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.v: A = None
        self.r: D = None
        self.o: D = None
        self.txt = txt

b = A("b")
l = B("l")
d = C("d")
g = D("g")
a = E("a")
i = F("i")

b.t = i
b.v = g
b.x = l
l.q = a
d.p = b
g.o = i
g.s = l
g.r = a
g.y = a
g.w = b
a.t = d
a.r = d
a.s = g
i.v = b
i.r = g
i.o = g
assert a.s.r.t.p.txt == "
class A:
    def __init__(self, txt: str):
        self.t: F = None
        self.v: D = None
        self.x: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.q: E = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.v: A = None
        self.r: D = None
        self.o: D = None
        self.txt = txt

b = A("b")
l = B("l")
d = C("d")
g = D("g")
a = E("a")
i = F("i")

b.t = i
b.v = g
b.x = l
l.q = a
d.p = b
g.o = i
g.s = l
g.r = a
g.y = a
g.w = b
a.t = d
a.r = d
a.s = g
i.v = b
i.r = g
i.o = g
assert a.s.r.t.p.txt == "b"