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

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

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

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

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

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

d = A("d")
c = B("c")
j = C("j")
l = D("l")
i = E("i")
b = F("b")

d.w = i
c.q = l
c.p = j
j.z = i
j.x = i
j.s = l
l.p = b
l.q = i
i.r = d
i.u = c
b.o = d
b.s = d
b.t = i
b.w = i
assert d.w.u.p.s.txt == "
class A:
    def __init__(self, txt: str):
        self.w: E = None
        self.txt = txt

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

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

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

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

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

d = A("d")
c = B("c")
j = C("j")
l = D("l")
i = E("i")
b = F("b")

d.w = i
c.q = l
c.p = j
j.z = i
j.x = i
j.s = l
l.p = b
l.q = i
i.r = d
i.u = c
b.o = d
b.s = d
b.t = i
b.w = i
assert d.w.u.p.s.txt == "l"