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

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

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

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

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

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

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

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

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

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

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

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

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

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

l.w = g
l.o = g
l.r = j
i.q = b
i.v = b
b.y = g
g.x = j
g.o = f
f.q = g
j.s = l
j.y = l
j.z = l
j.w = f
j.o = g
a.q = b
a.v = b
assert f.q.o.q.x.o.txt == "g"